2022-11-01 00:08:42 -06:00
|
|
|
#!/usr/bin/with-contenv bash
|
|
|
|
|
|
|
|
if [ -f "/opt/couchdb/data/.config_complete" ]; then
|
|
|
|
echo "Couchdb config has already completed, skipping"
|
|
|
|
else
|
2022-11-02 01:12:54 -06:00
|
|
|
#echo -n means we dont pass newline to base64 (ugh). eg. hello = aGVsbG8K vs aGVsbG8=
|
|
|
|
FASTEN_JWT_ISSUER_KEY_BASE64=$(echo -n "${FASTEN_JWT_ISSUER_KEY}" | base64)
|
2022-11-01 00:08:42 -06:00
|
|
|
|
|
|
|
|
2022-11-02 01:12:54 -06:00
|
|
|
cat << EOF >> /opt/couchdb/etc/local.d/generated.ini
|
2022-11-01 00:08:42 -06:00
|
|
|
|
|
|
|
; ------------------------------------------ GENERATED MODIFICATIONS
|
|
|
|
; ------------------------------------------ GENERATED MODIFICATIONS
|
|
|
|
; ------------------------------------------ GENERATED MODIFICATIONS
|
|
|
|
;
|
|
|
|
[jwt_auth]
|
|
|
|
required_claims = exp, {iss, "docker-fastenhealth"}
|
|
|
|
|
|
|
|
[jwt_keys]
|
2022-11-02 01:12:54 -06:00
|
|
|
hmac:_default = ${FASTEN_JWT_ISSUER_KEY_BASE64}
|
2022-11-01 00:08:42 -06:00
|
|
|
|
|
|
|
|
|
|
|
; users should change this default password
|
|
|
|
[admins]
|
|
|
|
${FASTEN_COUCHDB_ADMIN_USERNAME} = ${FASTEN_COUCHDB_ADMIN_PASSWORD}
|
2022-11-02 01:12:54 -06:00
|
|
|
|
2022-11-01 00:08:42 -06:00
|
|
|
EOF
|
|
|
|
|
|
|
|
# create the config complete flag
|
|
|
|
echo "Couchdb config: complete"
|
|
|
|
touch /opt/couchdb/data/.config_complete
|
|
|
|
|
|
|
|
fi
|