diff options
Diffstat (limited to 'build/postgrest/entrypoint.sh')
-rwxr-xr-x | build/postgrest/entrypoint.sh | 20 |
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 |