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