Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirection to Strapi endpoints for mobile app users #1641

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 3 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,8 @@ spec:
value: "varnish-{{ .Values.deployEnv }}-{{ .Release.Revision }}"
- name: SEARCH_HOST
value: "{{ .Values.nginx.SEARCH_HOST }}"
- name: STRAPI_LOCATION
value: "{{ .Values.localSettings.STRAPI_LOCATION }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs

  1. For .Values.localSettings.STRAPI_LOCATION to be defined in the values.yaml file of the chart. You can populate with a sensible default if all Sefaria environments will redirect to the same endpoint
  2. per-environment values to populated in the environment values files - build/ci/production-values.yaml for prod, build/ci/sandbox-values.yaml for per-commit tests, build/ci/integration-values.yaml for integration tests and create-cauldron.sh in the cauldrons repo for cauldrons.

{{- if .Values.linker.enabled }}
- name: LINKER_HOST
value: "linker-{{ .Values.deployEnv }}-{{ .Release.Revision }}"
Expand Down
Loading