build: make git-sync toggle + diag env-path aware
Grav Admin saves plugin config into the active environment's config tree (user/env/<host>/config/plugins/) when an env override dir exists — so git-sync.yaml landed there, not in user/config/plugins/. Update the toggle script to take a WEBROOT and search both locations (env path first), and update remote-git-sync-disable/enable to pass WEBROOT. remote-diag now surfaces git-sync config (secrets redacted) from either location. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Np4cMQLF77i664CAQXySzU
This commit is contained in:
@@ -1,13 +1,22 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
FILE="$1"
|
||||
# Enable/disable the git-sync plugin by flipping `enabled:` in its config.
|
||||
#
|
||||
# git-sync.yaml may live in the per-environment config tree
|
||||
# (user/env/<host>/config/plugins/) when an env override dir exists — Grav's
|
||||
# Admin saves config there when an environment is active — otherwise in the
|
||||
# standard user/config/plugins/. Search both, env path first.
|
||||
WEBROOT="$1"
|
||||
STATE="$2"
|
||||
: "${FILE:?usage: git-sync-toggle.sh <git-sync.yaml path> <true|false>}"
|
||||
: "${STATE:?usage: git-sync-toggle.sh <git-sync.yaml path> <true|false>}"
|
||||
: "${WEBROOT:?usage: git-sync-toggle.sh <webroot> <true|false>}"
|
||||
: "${STATE:?usage: git-sync-toggle.sh <webroot> <true|false>}"
|
||||
|
||||
if [ ! -f "$FILE" ]; then
|
||||
echo "ERROR: $FILE not found — is git-sync installed on this server?" >&2
|
||||
FILE=$(ls "$WEBROOT"/user/env/*/config/plugins/git-sync.yaml \
|
||||
"$WEBROOT"/user/config/plugins/git-sync.yaml 2>/dev/null | head -1)
|
||||
|
||||
if [ -z "$FILE" ] || [ ! -f "$FILE" ]; then
|
||||
echo "ERROR: git-sync.yaml not found under $WEBROOT — is git-sync installed/configured?" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -17,4 +26,4 @@ else
|
||||
printf 'enabled: %s\n' "$STATE" | cat - "$FILE" > "$FILE.tmp" && mv "$FILE.tmp" "$FILE"
|
||||
fi
|
||||
|
||||
echo "git-sync now: $(grep -E '^enabled:' "$FILE")"
|
||||
echo "git-sync now: $(grep -E '^enabled:' "$FILE") ($FILE)"
|
||||
|
||||
Reference in New Issue
Block a user