Skip to content

Commit

Permalink
Add dev template for Service (central)
Browse files Browse the repository at this point in the history
  • Loading branch information
sadiqkhoja committed Oct 20, 2023
1 parent 5af1671 commit bafc5ec
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 1 deletion.
50 changes: 50 additions & 0 deletions files/service/config.json.dev.template
Original file line number Diff line number Diff line change
@@ -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}"
}
}
}
}
8 changes: 7 additions & 1 deletion files/service/scripts/start-odk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
1 change: 1 addition & 0 deletions service.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bafc5ec

Please sign in to comment.