Alles tot aan database, en zaken hernoemd zodat het overeenkomt met boek
This commit is contained in:
24
scripts/init_db.sh
Executable file
24
scripts/init_db.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env zsh
|
||||
set -x
|
||||
set -eo pipefail
|
||||
|
||||
# Check if a custom user has been set, otherwise default to 'postgress'
|
||||
DB_USER="${POSTGRES_USER:=postgres}"
|
||||
# Check if a custom password has been set, otherwise default to 'password'
|
||||
DB_PASSWORD="${POSTGRES_PASSWORD:=password}"
|
||||
# Check if a custom database name has been set, otherwise default to 'newsletter'
|
||||
DB_NAME="${POSTGRES_DB:=newsletter}"
|
||||
# Check if a custom port has been set, otherwise default to '5432'
|
||||
DB_PORT="${POSTGRES_PORT:=5432}"
|
||||
# Check if a custom host has been set, otherwise default to 'localhost'
|
||||
DB_HOST="${POSTGRES_HOST:=localhost}"
|
||||
|
||||
# Launch postgres using Docker
|
||||
docker run \
|
||||
-e POSTGRES_USER=${DB_USER} \
|
||||
-e POSTGRES_PASSWORD=${DB_PASSWORD} \
|
||||
-e POSTGRES_DB=${DB_NAME} \
|
||||
-p "${DB_PORT}":5432 \
|
||||
-d postgres \
|
||||
postgres -N 1000
|
||||
# ^ Increased maximum number of connections for testing purposes
|
||||
Reference in New Issue
Block a user