diff --git a/files/service/config.json.dev.template b/files/service/config.json.dev.template new file mode 100644 index 00000000..6c08925e --- /dev/null +++ b/files/service/config.json.dev.template @@ -0,0 +1,50 @@ +{ + "default": { + "database": { + "host": "${DB_HOST}", + "user": "${DB_USER}", + "password": "${DB_PASSWORD}", + "database": "${DB_NAME}", + "ssl": ${DB_SSL} + }, + "email": { + "serviceAccount": "${EMAIL_FROM}", + "transport": "smtp", + "transportOpts": { + "host": "${EMAIL_HOST}", + "port": ${EMAIL_PORT}, + "secure": ${EMAIL_SECURE}, + "ignoreTLS": ${EMAIL_IGNORE_TLS}, + "auth": { + "user": "${EMAIL_USER}", + "pass": "${EMAIL_PASSWORD}" + } + } + }, + "xlsform": { + "host": "127.0.0.1", // localhost doesn't work here - don't know why (shrug) + "port": 5001 + }, + "enketo": { + "url": "http://localhost:8005/-", + "apiKey": "enketorules" + }, + "env": { + "domain": "http://localhost:8989", + "sysadminAccount": "${SYSADMIN_EMAIL}" + }, + "oidc": { + "enabled": ${OIDC_ENABLED}, + "issuerUrl": "${OIDC_ISSUER_URL}", + "clientId": "${OIDC_CLIENT_ID}", + "clientSecret": "${OIDC_CLIENT_SECRET}" + }, + "external": { + "sentry": { + "orgSubdomain": "${SENTRY_ORG_SUBDOMAIN}", + "key": "${SENTRY_KEY}", + "project": "${SENTRY_PROJECT}" + } + } + } +} diff --git a/files/service/scripts/start-odk.sh b/files/service/scripts/start-odk.sh index dd92d804..575aed95 100755 --- a/files/service/scripts/start-odk.sh +++ b/files/service/scripts/start-odk.sh @@ -2,10 +2,16 @@ echo "generating local service configuration.." +TEMPLATE_PATH=/usr/share/odk/config.json.template + +if [ "$ENV" = "DEV" ]; then + TEMPLATE_PATH=/usr/share/odk/config.json.dev.template +fi + ENKETO_API_KEY=$(cat /etc/secrets/enketo-api-key) \ BASE_URL=$( [ "${HTTPS_PORT}" = 443 ] && echo https://"${DOMAIN}" || echo https://"${DOMAIN}":"${HTTPS_PORT}" ) \ envsubst '$DOMAIN $BASE_URL $SYSADMIN_EMAIL $ENKETO_API_KEY $DB_HOST $DB_USER $DB_PASSWORD $DB_NAME $DB_SSL $EMAIL_FROM $EMAIL_HOST $EMAIL_PORT $EMAIL_SECURE $EMAIL_IGNORE_TLS $EMAIL_USER $EMAIL_PASSWORD $OIDC_ENABLED $OIDC_ISSUER_URL $OIDC_CLIENT_ID $OIDC_CLIENT_SECRET $SENTRY_ORG_SUBDOMAIN $SENTRY_KEY $SENTRY_PROJECT' \ - < /usr/share/odk/config.json.template \ + < $TEMPLATE_PATH \ > /usr/odk/config/local.json SENTRY_RELEASE="$(cat sentry-versions/server)" diff --git a/service.dockerfile b/service.dockerfile index 11f5e280..6e9ff6c3 100644 --- a/service.dockerfile +++ b/service.dockerfile @@ -30,6 +30,7 @@ COPY server/ ./ COPY files/service/scripts/ ./ COPY files/service/config.json.template /usr/share/odk/ +COPY files/service/config.json.dev.template /usr/share/odk/ COPY files/service/odk-cmd /usr/bin/ COPY --from=intermediate /tmp/sentry-versions/ ./sentry-versions