Prepare runner-only provisioning for approved editor secrets
Validate / validate (push) Successful in 3m46s
Validate / validate (push) Successful in 3m46s
This commit is contained in:
+2
-1
@@ -41,7 +41,7 @@ if [ ! -s "$ENVF" ]; then
|
||||
umask 077
|
||||
printf 'DATABASE_URL=postgres://%s:%s@127.0.0.1:%s/%s\n' "$DB" "$PW" "$PGPORT" "$DB" > "$ENVF"
|
||||
fi
|
||||
PW=$(sed -E 's#^DATABASE_URL=postgres://[^:]+:([^@]+)@.*#\1#' "$ENVF")
|
||||
PW=$(sed -nE 's#^DATABASE_URL=postgres://[^:]+:([^@]+)@.*#\1#p' "$ENVF")
|
||||
# keep the role password and the env file in sync; create role/db only when missing
|
||||
if [ "$(psql_admin "-c \"select 1 from pg_roles where rolname='$DB'\"")" = 1 ]; then
|
||||
psql_admin "-c \"alter role $DB with login password '$PW'\"" >/dev/null
|
||||
@@ -50,6 +50,7 @@ else
|
||||
fi
|
||||
[ "$(psql_admin "-c \"select 1 from pg_database where datname='$DB'\"")" = 1 ] || psql_admin "-c \"create database $DB owner $DB\"" >/dev/null
|
||||
chmod 600 "$ENVF"
|
||||
python3 scripts/configure-editor.py "$ENVF"
|
||||
set -a; . "$ENVF"; set +a
|
||||
PGPASSWORD=$PW psql -h 127.0.0.1 -p "$PGPORT" -U "$DB" -d "$DB" -qtAc 'select 1' >/dev/null || { echo "cannot log in to postgres as $DB" >&2; exit 1; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user