xssbook2/build/postgrest/entrypoint.sh

21 lines
610 B
Bash
Executable file

#!/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