Skip to content

Commit

Permalink
Merge pull request #1641 from Sefaria/feature/sc-19579/redirection-to…
Browse files Browse the repository at this point in the history
…-strapi-endpoint-for-mobile

Redirection to Strapi endpoints for mobile app users
  • Loading branch information
relyks committed Sep 20, 2023
2 parents 9f82072 + 7b0214b commit 3fca137
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 8 additions & 0 deletions helm-chart/sefaria-project/templates/configmap/nginx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,14 @@ data:
proxy_pass http://varnish_upstream;
}
location /static/mobile/message-en.json {
return 301 ${STRAPI_LOCATION}/api/mobile-message;
}
location /static/mobile/message-he.json {
return 301 ${STRAPI_LOCATION}/api/mobile-message-he;
}
location /static/ {
access_log off;
alias /app/static/;
Expand Down
7 changes: 6 additions & 1 deletion helm-chart/sefaria-project/templates/rollout/nginx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ spec:
imagePullPolicy: Always
command: ["bash", "-c"]
# https://serverfault.com/questions/577370/how-can-i-use-environment-variables-in-nginx-conf
args: [ "envsubst '${ENV_NAME},${VARNISH_HOST},${SEARCH_HOST},${RELEASE_TAG}{{- if .Values.linker.enabled }},${LINKER_HOST}{{- end }}{{- if .Values.instrumentation.enabled }},${NGINX_VERSION}{{- end }}' < /conf/nginx.template.conf > /nginx.conf && exec nginx -c /nginx.conf -g 'daemon off;'" ]
args: [ "envsubst '${ENV_NAME},${VARNISH_HOST},${SEARCH_HOST},${RELEASE_TAG},${STRAPI_LOCATION}{{- if .Values.linker.enabled }},${LINKER_HOST}{{- end }}{{- if .Values.instrumentation.enabled }},${NGINX_VERSION}{{- end }}' < /conf/nginx.template.conf > /nginx.conf && exec nginx -c /nginx.conf -g 'daemon off;'" ]
ports:
- containerPort: 80
- containerPort: 443
Expand Down Expand Up @@ -96,6 +96,11 @@ spec:
value: "varnish-{{ .Values.deployEnv }}-{{ .Release.Revision }}"
- name: SEARCH_HOST
value: "{{ .Values.nginx.SEARCH_HOST }}"
- name: STRAPI_LOCATION
valueFrom:
secretKeyRef:
name: {{ .Values.secrets.localSettings.ref }}
key: STRAPI_LOCATION
{{- if .Values.linker.enabled }}
- name: LINKER_HOST
value: "linker-{{ .Values.deployEnv }}-{{ .Release.Revision }}"
Expand Down

0 comments on commit 3fca137

Please sign in to comment.