summaryrefslogtreecommitdiff
path: root/build/postgrest/entrypoint.sh
blob: d375769de18b9d5034467023cdac326125714fce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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