Merge remote-tracking branch 'origin/main' into feat/journal-post-form
# Conflicts: # user
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