Skip to content
This repository was archived by the owner on Feb 12, 2022. It is now read-only.

Commit ebbe4f2

Browse files
committed
Fix to allow release without an Admin Key
1 parent 191d3bc commit ebbe4f2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

bin/prerelease

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,20 @@ set -u
55
psql $DATABASE_URL -c "SELECT 1 FROM consumers"
66
data_exists=$?
77

8-
if [ ! $data_exists -eq 0 ] && [ -n "$KONG_HEROKU_ADMIN_KEY" ]
8+
# Admin key is empty when the var is unset.
9+
admin_key="${KONG_HEROKU_ADMIN_KEY:-}"
10+
11+
if [ ! $data_exists -eq 0 ] && [ -n "$admin_key" ]
912
then
1013
echo "Loading base Kong config to enable secure proxy to Admin API"
1114
pg_restore --verbose --clean --no-acl --no-owner -d "$DATABASE_URL" $HOME/config/pg-heroku-admin.dump
1215
fi
1316

1417
set -e
1518

16-
if [ -n "$KONG_HEROKU_ADMIN_KEY" ]
19+
if [ -n "$admin_key" ]
1720
then
1821
echo "Setting Admin API key to value of KONG_HEROKU_ADMIN_KEY"
1922
# This `id` matches the "kong-admin" keyauth_credentials record contained in "config/pg-heroku-admin.dump"
20-
psql "$DATABASE_URL" -c "UPDATE keyauth_credentials SET key='$KONG_HEROKU_ADMIN_KEY' WHERE id='ac8af1d3-377a-41ae-9fd5-dbf98c599c5c';"
23+
psql "$DATABASE_URL" -c "UPDATE keyauth_credentials SET key='${admin_key}' WHERE id='ac8af1d3-377a-41ae-9fd5-dbf98c599c5c';"
2124
fi

0 commit comments

Comments
 (0)