Skip to content

Commit

Permalink
feat: use hcaptcha environment variable during build
Browse files Browse the repository at this point in the history
  • Loading branch information
roshni73 authored and samshara committed Nov 29, 2024
1 parent a7c2db9 commit cbe4b1b
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ ENV APP_ENVIRONMENT=APP_ENVIRONMENT_PLACEHOLDER
ENV APP_MAPBOX_ACCESS_TOKEN=APP_MAPBOX_ACCESS_TOKEN_PLACEHOLDER

Check warning on line 33 in Dockerfile

View workflow job for this annotation

GitHub Actions / Publish Docker Image

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "APP_MAPBOX_ACCESS_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ENV APP_GOOGLE_ANALYTICS_ID=APP_GOOGLE_ANALYTICS_ID_PLACEHOLDER
ENV APP_GRAPHQL_API_ENDPOINT=https://APP-GRAPHQL-API-ENDPOINT-PLACEHOLDER.COM/
ENV APP_HCAPTCHA_SITEKEY=APP_HCAPTCHA_SITEKEY_PLACEHOLDER

# Build variables (Requires backend pulled)
ENV APP_GRAPHQL_CODEGEN_ENDPOINT=./backend/schema.graphql
Expand Down
2 changes: 2 additions & 0 deletions nginx-serve/apply-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ find "$DESTINATION_DIRECTORY" -type f -exec sed -i "s|\<APP_ENVIRONMENT_PLACEHOL
find "$DESTINATION_DIRECTORY" -type f -exec sed -i "s|\<APP_MAPBOX_ACCESS_TOKEN_PLACEHOLDER\>|$APP_MAPBOX_ACCESS_TOKEN|g" {} +
find "$DESTINATION_DIRECTORY" -type f -exec sed -i "s|\<APP_GOOGLE_ANALYTICS_ID_PLACEHOLDER\>|$APP_GOOGLE_ANALYTICS_ID|g" {} +
find "$DESTINATION_DIRECTORY" -type f -exec sed -i "s|\<https://APP-GRAPHQL-API-ENDPOINT-PLACEHOLDER.COM/|$APP_GRAPHQL_API_ENDPOINT|g" {} +
find "$DESTINATION_DIRECTORY" -type f -exec sed -i "s|\<APP_HCAPTCHA_SITEKEY_PLACEHOLDER|$APP_HCAPTCHA_SITEKEY|g" {} +


# Show diffs (Useful to debug issues)
set +xe
Expand Down
1 change: 1 addition & 0 deletions nginx-serve/helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ data:
APP_MAPBOX_ACCESS_TOKEN: {{ required "env.APP_MAPBOX_ACCESS_TOKEN" .Values.env.APP_MAPBOX_ACCESS_TOKEN | quote }}
APP_GOOGLE_ANALYTICS_ID: {{ .Values.env.APP_GOOGLE_ANALYTICS_ID | quote }}
APP_GRAPHQL_API_ENDPOINT: {{ required "env.APP_GRAPHQL_API_ENDPOINT" .Values.env.APP_GRAPHQL_API_ENDPOINT | quote }}
APP_HCAPTCHA_SITEKEY: {{ required "env.APP_HCAPTCHA_SITEKEY" .Values.env.APP_HCAPTCHA_SITEKEY | quote }}
4 changes: 2 additions & 2 deletions nginx-serve/helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ spec:
replicas: 1
selector:
matchLabels:
app: {{ template "ifrcgo-web-app.name" . }}
app: {{ template "ifrcgo-web-app.fullname" . }}
release: {{ .Release.Name }}
run: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "ifrcgo-web-app.name" . }}
app: {{ template "ifrcgo-web-app.fullname" . }}
release: {{ .Release.Name }}
run: {{ .Release.Name }}
spec:
Expand Down
4 changes: 2 additions & 2 deletions nginx-serve/helm/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ kind: Service
metadata:
name: {{ template "ifrcgo-web-app.fullname" . }}-svc
labels:
app: {{ template "ifrcgo-web-app.name" . }}
app: {{ template "ifrcgo-web-app.fullname" . }}
environment: {{ .Values.environment }}
release: {{ .Release.Name }}
spec:
type: ClusterIP
selector:
app: {{ template "ifrcgo-web-app.name" . }}
app: {{ template "ifrcgo-web-app.fullname" . }}
release: {{ .Release.Name }}
run: {{ .Release.Name }}
ports:
Expand Down
1 change: 1 addition & 0 deletions nginx-serve/helm/values-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ env:
APP_ENVIRONMENT: ALPHA-1
APP_MAPBOX_ACCESS_TOKEN: pk.ab.xy
APP_GRAPHQL_API_ENDPOINT: https://alert-hub-1.ifrc-go.org/graphql/
APP_HCAPTCHA_SITEKEY:
1 change: 1 addition & 0 deletions nginx-serve/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ env:
APP_MAPBOX_ACCESS_TOKEN:
APP_GOOGLE_ANALYTICS_ID:
APP_GRAPHQL_API_ENDPOINT: https://alerthub-api.ifrc.org/graphql/
APP_HCAPTCHA_SITEKEY:

0 comments on commit cbe4b1b

Please sign in to comment.