Make portainer skill use portable config paths
This commit is contained in:
@@ -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
|
||||
@@ -19,7 +38,7 @@ Usage: get-stack-compose.sh "<stack-name>"
|
||||
|
||||
Gets the docker-compose.yml content for a Portainer stack by name.
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user