Skip to content

Commit

Permalink
rename; use in more contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndrsn committed Dec 9, 2024
1 parent 19808d3 commit 1b53af7
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fetch-depth: 0
fetch-tags: true
submodules: recursive
- run: cd test/envsubber && ./run-tests.sh
- run: cd test/envsub && ./run-tests.sh
test-nginx:
timeout-minutes: 10
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions enketo.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ WORKDIR ${ENKETO_SRC_DIR}
# care about anything the server needs. because the client config is baked at
# build time, we therefore hand it the untemplated config.

COPY files/shared/envsub.sh /scripts/
COPY files/enketo/config.json.template ${ENKETO_SRC_DIR}/config/config.json.template
COPY files/enketo/config.json.template ${ENKETO_SRC_DIR}/config/config.json
COPY files/enketo/start-enketo.sh ${ENKETO_SRC_DIR}/start-enketo.sh
Expand Down
2 changes: 1 addition & 1 deletion files/enketo/start-enketo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ BASE_URL=$( [ "${HTTPS_PORT}" = 443 ] && echo https://"${DOMAIN}" || echo https:
SECRET=$(cat /etc/secrets/enketo-secret) \
LESS_SECRET=$(cat /etc/secrets/enketo-less-secret) \
API_KEY=$(cat /etc/secrets/enketo-api-key) \
envsubst \
/scripts/envsub.sh \
< "$CONFIG_PATH.template" \
> "$CONFIG_PATH"

Expand Down
4 changes: 2 additions & 2 deletions files/nginx/setup-odk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if [[ $OIDC_ENABLED != 'true' ]] && [[ $OIDC_ENABLED != 'false' ]]; then
exit 1
fi

/scripts/envsubber \
/scripts/envsub.sh \
< /usr/share/odk/nginx/client-config.json.template \
> /usr/share/nginx/html/client-config.json

Expand All @@ -32,7 +32,7 @@ echo "writing fresh nginx templates..."
cp /usr/share/odk/nginx/redirector.conf /etc/nginx/conf.d/redirector.conf

CNAME=$( [ "$SSL_TYPE" = "customssl" ] && echo "local" || echo "$DOMAIN") \
nginx_envsubst \
/scripts/envsub.sh \
< /usr/share/odk/nginx/odk.conf.template \
> /etc/nginx/conf.d/odk.conf

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 \
/scripts/envsub.sh \
< /usr/share/odk/config.json.template \
> /usr/odk/config/local.json

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion nginx.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RUN apt-get update && apt-get install -y netcat-openbsd
RUN mkdir -p /usr/share/odk/nginx/

COPY files/nginx/setup-odk.sh \
files/nginx/envsubber \
files/shared/envsub.sh \
/scripts/
RUN chmod +x /scripts/setup-odk.sh

Expand Down
1 change: 1 addition & 0 deletions service.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ RUN apt-get update \
--fund=false --update-notifier=false

COPY server/ ./
COPY files/shared/envsub.sh /scripts/
COPY files/service/scripts/ ./

COPY files/service/config.json.template /usr/share/odk/
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions test/envsubber/run-tests.sh → test/envsub/run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -eu

log() { echo >&2 "[test/envsubber] $*"; }
log() { echo >&2 "[test/envsub] $*"; }


failed=0
Expand All @@ -10,7 +10,7 @@ if diff <( \
SIMPLE=sv_simple \
SUBVAL_1=sub_val_one \
SUBVAL_2=sub_val_two \
../../files/nginx/envsubber \
../../files/shared/envsub.sh \
< good-example.in
) good-example.expected; then
log " OK"
Expand All @@ -20,7 +20,7 @@ else
fi

log "should fail when asked to substitute undefined value"
if ! ../../files/nginx/envsubber <<<'${NOT_DEFINED}'; then
if ! ../../files/shared/envsub.sh <<<'${NOT_DEFINED}'; then
log " OK"
else
failed=1
Expand Down

0 comments on commit 1b53af7

Please sign in to comment.