daddy/misc/containers/postgres/initdb.d/init-databases.sh

15 lines
473 B
Bash

#!/bin/bash
set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER hydra WITH ENCRYPTED PASSWORD 'hydra';
CREATE DATABASE hydra;
GRANT ALL PRIVILEGES ON DATABASE hydra TO hydra;
EOSQL
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER daddy WITH ENCRYPTED PASSWORD 'daddy';
CREATE DATABASE daddy;
GRANT ALL PRIVILEGES ON DATABASE daddy TO daddy;
EOSQL