summaryrefslogtreecommitdiff
path: root/build/postgrest/entrypoint.sh
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-03-29 22:29:56 -0400
committerFreya Murphy <freya@freyacat.org>2024-03-29 22:29:56 -0400
commit944b6b0526032ad8c1b4a2612d6723bec75e0e4c (patch)
treed3da5584df33a7878c087622b4fc2ec2883cf880 /build/postgrest/entrypoint.sh
downloadxssbook2-944b6b0526032ad8c1b4a2612d6723bec75e0e4c.tar.gz
xssbook2-944b6b0526032ad8c1b4a2612d6723bec75e0e4c.tar.bz2
xssbook2-944b6b0526032ad8c1b4a2612d6723bec75e0e4c.zip
start database (user and post), and initial barebones home page
Diffstat (limited to 'build/postgrest/entrypoint.sh')
-rwxr-xr-xbuild/postgrest/entrypoint.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/build/postgrest/entrypoint.sh b/build/postgrest/entrypoint.sh
new file mode 100755
index 0000000..d375769
--- /dev/null
+++ b/build/postgrest/entrypoint.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+mkdir /etc/postgrest.d
+config=/etc/postgrest.d/postgrest.conf
+
+PGRST_DB_URI="postgres://authenticator:postgrest@db:5432/$POSTGRES_DB"
+PGRST_ROLE="rest_anon"
+PGRST_SCHEMA="api"
+
+rm -fr "$config"
+touch "$config"
+printf 'db-uri = "%s"\n' "$PGRST_DB_URI" >> $config
+printf 'db-anon-role = "%s"\n' "$PGRST_ROLE" >> $config
+printf 'db-schemas = "%s"\n' "$PGRST_SCHEMA" >> $config
+printf 'jwt-secret = "%s"\n' "$JWT_SECRET" >> $config
+printf 'jwt-secret-is-base64 = false\n' >> $config
+printf 'server-host = "*"\n' >> $config
+printf 'server-port = 3000\n' >> $config
+
+exec /usr/local/bin/postgrest $config