Skip to content

Commit

Permalink
Remove OIDC_ENABLED config
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-white committed Aug 10, 2023
1 parent f666acc commit 6a66762
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
1 change: 0 additions & 1 deletion .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ HTTPS_PORT=443
# EMAIL_PASSWORD=

# Optional: configure Single Sign-on with OpenID Connect
# OIDC_ENABLED=
# OIDC_DISCOVERY_URL=
# OIDC_CLIENT_ID=
# OIDC_CLIENT_SECRET=
Expand Down
5 changes: 3 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ services:
- EMAIL_IGNORE_TLS=${EMAIL_IGNORE_TLS:-true}
- EMAIL_USER=${EMAIL_USER:-''}
- EMAIL_PASSWORD=${EMAIL_PASSWORD:-''}
- OIDC_ENABLED=${OIDC_ENABLED:-false}
- OIDC_DISCOVERY_URL=${OIDC_DISCOVERY_URL:-''}
- OIDC_CLIENT_ID=${OIDC_CLIENT_ID:-''}
- OIDC_CLIENT_SECRET=${OIDC_CLIENT_SECRET:-''}
Expand All @@ -79,7 +78,9 @@ services:
build:
context: .
args:
- OIDC_ENABLED=${OIDC_ENABLED:-false}
- OIDC_DISCOVERY_URL=${OIDC_DISCOVERY_URL:-''}
- OIDC_CLIENT_ID=${OIDC_CLIENT_ID:-''}
- OIDC_CLIENT_SECRET=${OIDC_CLIENT_SECRET:-''}
dockerfile: nginx.dockerfile
depends_on:
- service
Expand Down
6 changes: 5 additions & 1 deletion files/prebuild/build-frontend.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash -eu
cd client
npm clean-install --no-audit --fund=false --update-notifier=false
VUE_APP_OIDC_ENABLED="$OIDC_ENABLED" npm run build
if [[ -n $OIDC_DISCOVERY_URL && -n $OIDC_CLIENT_ID && -n $OIDC_CLIENT_SECRET ]]; then
# shellcheck disable=SC2034
VUE_APP_OIDC_ENABLED=true
fi
npm run build
1 change: 0 additions & 1 deletion files/service/config.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"sysadminAccount": "${SYSADMIN_EMAIL}"
},
"oidc": {
"enabled": ${OIDC_ENABLED},
"discoveryUrl": "${OIDC_DISCOVERY_URL}",
"clientId": "${OIDC_CLIENT_ID}",
"clientSecret": "${OIDC_CLIENT_SECRET}"
Expand Down
2 changes: 1 addition & 1 deletion files/service/scripts/start-odk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ echo "generating local service configuration.."

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_DISCOVERY_URL $OIDC_CLIENT_ID $OIDC_CLIENT_SECRET $SENTRY_ORG_SUBDOMAIN $SENTRY_KEY $SENTRY_PROJECT' \
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_DISCOVERY_URL $OIDC_CLIENT_ID $OIDC_CLIENT_SECRET $SENTRY_ORG_SUBDOMAIN $SENTRY_KEY $SENTRY_PROJECT' \
< /usr/share/odk/config.json.template \
> /usr/odk/config/local.json

Expand Down
7 changes: 5 additions & 2 deletions nginx.dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
ARG OIDC_ENABLED
FROM node:18.17 as intermediate
ARG OIDC_DISCOVERY_URL
ARG OIDC_CLIENT_ID
ARG OIDC_CLIENT_SECRET

COPY ./ ./
RUN files/prebuild/write-version.sh
RUN OIDC_ENABLED="$OIDC_ENABLED" files/prebuild/build-frontend.sh
RUN OIDC_DISCOVERY_URL="$OIDC_DISCOVERY_URL" OIDC_CLIENT_ID="$OIDC_CLIENT_ID" OIDC_CLIENT_SECRET="$OIDC_CLIENT_SECRET" \
files/prebuild/build-frontend.sh

# when upgrading, look for upstream changes to redirector.conf
# also, confirm setup-odk.sh strips out HTTP-01 ACME challenge location
Expand Down

0 comments on commit 6a66762

Please sign in to comment.