0.27.6 — guard seed-secrets: skip if Infisical already populated
This commit is contained in:
@@ -1,12 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# One-shot: populate Infisical with oikos secrets.
|
# One-shot: populate Infisical with oikos secrets from container env.
|
||||||
# Extracts secret values from running containers (where docker-compose
|
# Only runs if Infisical is empty (first bootstrap). Safe to re-run.
|
||||||
# injects them from the host .env) and pushes them into Infisical via
|
|
||||||
# the api container's oikos binary.
|
|
||||||
#
|
#
|
||||||
# Usage: ./scripts/seed-secrets.sh
|
# Usage: ./scripts/seed-secrets.sh
|
||||||
#
|
|
||||||
# Safe to re-run (set is idempotent).
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@@ -16,6 +12,16 @@ COMPOSE="docker compose -f $REPO_DIR/docker-compose.yml"
|
|||||||
|
|
||||||
echo "=== seed-secrets: $(date) ==="
|
echo "=== seed-secrets: $(date) ==="
|
||||||
|
|
||||||
|
# Skip if Infisical already has secrets (avoid overwriting real values
|
||||||
|
# with dev defaults from docker-compose).
|
||||||
|
existing=$($COMPOSE exec -T api /oikos secret list 2>/dev/null | grep -c . || echo 0)
|
||||||
|
if [ "$existing" -gt 3 ]; then
|
||||||
|
echo "SKIP: Infisical already has $existing secrets (bootstrap complete)"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Infisical has $existing secrets — seeding..."
|
||||||
|
|
||||||
set_count=0
|
set_count=0
|
||||||
skip_count=0
|
skip_count=0
|
||||||
fail_count=0
|
fail_count=0
|
||||||
|
|||||||
Reference in New Issue
Block a user