summaryrefslogtreecommitdiff
path: root/build/postgrest/entrypoint.sh
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-12-23 10:39:16 -0500
committerFreya Murphy <freya@freyacat.org>2024-12-23 10:39:16 -0500
commitde9cae795f93d03e68d965c59af4b21d96df4ec7 (patch)
treead4f903c04630b3b92e2b9b5d06d5b8647d299bb /build/postgrest/entrypoint.sh
parentlicense (diff)
downloadcrimson-de9cae795f93d03e68d965c59af4b21d96df4ec7.tar.gz
crimson-de9cae795f93d03e68d965c59af4b21d96df4ec7.tar.bz2
crimson-de9cae795f93d03e68d965c59af4b21d96df4ec7.zip
initial
Diffstat (limited to 'build/postgrest/entrypoint.sh')
-rwxr-xr-xbuild/postgrest/entrypoint.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/build/postgrest/entrypoint.sh b/build/postgrest/entrypoint.sh
new file mode 100755
index 0000000..6a944f2
--- /dev/null
+++ b/build/postgrest/entrypoint.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+config=/etc/postgrest.d/postgrest.conf
+
+JWT_SECRET="$API_SECRET"
+
+PGRST_DB_URI="postgres://authenticator:postgrest@postgres:5432/$POSTGRES_DB"
+PGRST_ROLE="$API_ROLE"
+PGRST_SCHEMA="$API_SCHEMA"
+
+rm -fr "$config"
+touch "$config"
+{
+ printf 'db-uri = "%s"\n' "$PGRST_DB_URI";
+ printf 'db-anon-role = "%s"\n' "$PGRST_ROLE";
+ printf 'db-schemas = "%s"\n' "$PGRST_SCHEMA";
+ printf 'jwt-secret = "%s"\n' "$JWT_SECRET";
+ printf 'jwt-secret-is-base64 = false\n';
+ printf 'server-host = "*"\n';
+ printf 'server-port = 3000\n';
+} >> $config
+
+exec -a /usr/local/bin/postgrest /usr/local/bin/postgrest "$config"