Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,19 @@ services:
jwt-generator:
container_name: giwa-jwt-generator
image: alpine/openssl
entrypoint: >
/bin/sh -c "[ ! -s /shared/jwtsecret.key ] && openssl rand -hex 32 | tr -d '\n' > /shared/jwtsecret.key || exit 0"
entrypoint:
- /bin/sh
- -c
- |
set -e
# Write to a temp file and check it before promoting: a failed openssl
# or a failed write must not leave an absent or empty secret behind,
# and must not report success to service_completed_successfully.
if [ ! -s /shared/jwtsecret.key ]; then
openssl rand -hex 32 | tr -d '\n' > /shared/jwtsecret.key.tmp
[ -s /shared/jwtsecret.key.tmp ]
mv /shared/jwtsecret.key.tmp /shared/jwtsecret.key
fi
volumes:
- shared:/shared
restart: "no"
Expand Down