17 lines
520 B
Bash
Executable File
17 lines
520 B
Bash
Executable File
#!/bin/sh
|
|
# Creates local secrets for the Compose stack. Never overwrites an existing secret:
|
|
# the PostgreSQL volume is initialised with the first password and keeps it.
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
|
|
mkdir -p secrets
|
|
|
|
if [ ! -s secrets/db_password ]; then
|
|
# Readable by the non-root users inside the api/postgres containers (bind-mounted as is).
|
|
umask 022
|
|
openssl rand -hex 24 > secrets/db_password
|
|
echo "created secrets/db_password"
|
|
else
|
|
echo "secrets/db_password already exists, keeping it"
|
|
fi
|