Skip to content

Commit e61819d

Browse files
chore(internal): support env vars in ./scripts/repl
1 parent c9ad730 commit e61819d

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

scripts/repl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ if [ "$PG_MAJOR_VERSION" -ge 18 ]; then
2929
done
3030
POSTGRES_CONFIG=(-c extension_control_path="$(realpath temp/install/share/postgresql)")
3131
else
32-
# In PostgreSQL <18 we cannot point `postgres` to our local extensions directory. So we install directly to
33-
# the system.
32+
# In PostgreSQL <18 we cannot point `postgres` to our local extensions directory. So we install
33+
# directly to the system.
3434
sudo make install PG_CONFIG="$(command -v pg_config)"
3535
fi
3636

@@ -61,10 +61,17 @@ done
6161
echo "==> Running setup.sql"
6262
psql -d postgres -f test/sql/create_extension.sql
6363

64+
if [ -n "$STRIPE_SECRET_KEY" ]; then
65+
psql -d postgres --variable "value='$STRIPE_SECRET_KEY'" -c 'ALTER DATABASE postgres SET stripe.secret_key = :value;'
66+
fi
67+
if [ -n "$STRIPE_BASE_URL" ]; then
68+
psql -d postgres --variable "value='$STRIPE_BASE_URL'" -c 'ALTER DATABASE postgres SET stripe.base_url = :value;'
69+
fi
70+
6471
if command -v pgcli &>/dev/null; then
6572
echo "==> Starting pgcli REPL"
6673
pgcli postgres
6774
else
6875
echo "==> Starting psql REPL (TIP: Install pgcli for better autocomplete!)"
6976
psql -d postgres
70-
fi
77+
fi

0 commit comments

Comments
 (0)