feat: APPS_DIR environment layer (Plan 14 step 2)

new-service/delete-service read and write $GITOPS_DIR/$APPS_DIR (default apps-homelab)
instead of the literal apps/; FORGEJO_URL moves to git.holtlabs.xyz.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
nholtware 2026-11-11 14:01:32 -06:00
parent 5b4987a371
commit 11c68770e1
5 changed files with 23 additions and 19 deletions

View file

@ -80,6 +80,9 @@ load_config() {
for v in curl jq git kubectl; do need_cmd "$v"; done
export KUBECONFIG
# Environment layer (Plan 14): the gitops dir this service's Application goes in.
APPS_DIR=${APPS_DIR:-apps-homelab}
[[ -d $GITOPS_DIR/$APPS_DIR ]] || die "platform.env: APPS_DIR=$APPS_DIR does not exist in $GITOPS_DIR"
# Public access is optional config; only --public / delete-service use it.
PUBLIC_DOMAIN=${PUBLIC_DOMAIN:-} CF_ZONE_ID=${CF_ZONE_ID:-} CF_TUNNEL_ID=${CF_TUNNEL_ID:-}
CLOUDFLARE_TOKEN_FILE=${CLOUDFLARE_TOKEN_FILE:-}
@ -249,9 +252,9 @@ gitops_commit_push() {
die "gitops push failed after 5 attempts"
}
# app_namespace NAME: destination namespace from gitops apps/NAME.yaml (empty if absent).
# app_namespace NAME: destination namespace from gitops $APPS_DIR/NAME.yaml (empty if absent).
app_namespace() {
local f=$GITOPS_DIR/apps/$1.yaml
local f=$GITOPS_DIR/$APPS_DIR/$1.yaml
[[ -f $f ]] || return 0
awk '/^ destination:/{d=1; next} d && /^ namespace:/{print $2; exit}' "$f"
}