Make portainer skill use portable config paths

This commit is contained in:
Stefano Fiorini
2026-03-08 20:56:17 -05:00
parent f38b13c563
commit 3e611621d6
13 changed files with 234 additions and 24 deletions

View File

@@ -2,7 +2,26 @@
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CONFIG_PATH="/home/node/.openclaw/workspace/.clawdbot/credentials/portainer/config.json"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SEARCH_DIR="$SCRIPT_DIR"
CONFIG_PATH=""
while true; do
CANDIDATE="$SEARCH_DIR/.clawdbot/credentials/portainer/config.json"
if [[ -f "$CANDIDATE" ]]; then
CONFIG_PATH="$CANDIDATE"
break
fi
PARENT="$(dirname "$SEARCH_DIR")"
if [[ "$PARENT" == "$SEARCH_DIR" ]]; then
break
fi
SEARCH_DIR="$PARENT"
done
if [[ -z "$CONFIG_PATH" && -f "$HOME/.clawdbot/credentials/portainer/config.json" ]]; then
CONFIG_PATH="$HOME/.clawdbot/credentials/portainer/config.json"
fi
err() {
echo "Error: $*" >&2
@@ -32,7 +51,7 @@ Options:
but are no longer in use (old versions left dangling).
Requires config at:
/home/node/.openclaw/workspace/.clawdbot/credentials/portainer/config.json
workspace .clawdbot/credentials/portainer/config.json or ~/.clawdbot/credentials/portainer/config.json
EOF
exit 2
}