Skip to content

Commit

Permalink
update to CSRF_TRUSTED_ORIGINS env variable on helm and sls files
Browse files Browse the repository at this point in the history
  • Loading branch information
romer8 committed Oct 23, 2024
1 parent 0d241df commit b2aa8e0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 2 additions & 0 deletions charts/ciroh/ci/prod_aws_values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ tethys:
configMap:
name: 'cirohportal-prod-configmap'
env:
PUBLIC_PORTAL_PROTOCOL:
value: 'https'
TETHYS_DB_ENGINE:
value: 'django.db.backends.postgresql'
SKIP_DB_SETUP:
Expand Down
2 changes: 2 additions & 0 deletions charts/ciroh/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ spec:
# Tethys settings defined outside the env
- name: ALLOWED_HOSTS
value: "\"[{{- range .Values.ingresses.external.hosts }}{{ .host }},{{- end }}]\""
- name: CSRF_TRUSTED_ORIGINS
value: "\"[{{- range $index, $host := .Values.ingresses.external.hosts }}{{ if $index }},{{ end }}{{ $.Values.tethys.env.PUBLIC_PORTAL_PROTOCOL.value }}://{{ $host.host }}{{- end }}]\""
# redis values
- name: CHANNEL_LAYERS_CONFIG
value: "\"{'hosts':[{'host':\ {{ .Values.redis.fullnameOverride }}-master,\ 'port':\ {{ .Values.redis.master.containerPorts.redis }}}]}\""
Expand Down
15 changes: 8 additions & 7 deletions salt/config.sls
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
{% set CHANNEL_LAYERS_BACKEND = salt['environ.get']('CHANNEL_LAYERS_BACKEND') %}
{% set CHANNEL_LAYERS_CONFIG = salt['environ.get']('CHANNEL_LAYERS_CONFIG') %}
{% set PREFIX_URL = salt['environ.get']('PREFIX_URL') %}


{% set ALLOWED_HOSTS = salt['environ.get']('ALLOWED_HOSTS') %}
{% set CSRF_TRUSTED_ORIGINS = salt['environ.get']('CSRF_TRUSTED_ORIGINS') %}


Pre_Apps_Settings:
Expand All @@ -24,33 +23,35 @@ Set_Tethys_Settings_For_Apps:
tethys settings --set FILE_UPLOAD_MAX_MEMORY_SIZE {{ FILE_UPLOAD_MAX_MEMORY_SIZE }} &&
tethys settings --set DATA_UPLOAD_MAX_MEMORY_SIZE {{ FILE_UPLOAD_MAX_MEMORY_SIZE }} &&
tethys settings --set DATA_UPLOAD_MAX_NUMBER_FIELDS {{ FILE_UPLOAD_MAX_MEMORY_SIZE }}
- unless: /bin/bash -c "[ -f "{{ TETHYS_PERSIST }}/init_apps_setup_complete" ];"
- unless: /bin/bash -c "[ -f "{{ TETHYS_PERSIST }}/config_complete" ];"

Set_White_Listed_Origins:
cmd.run:
- name: >
tethys settings --set CSRF_TRUSTED_ORIGINS {{ ALLOWED_HOSTS }}
tethys settings --set CSRF_TRUSTED_ORIGINS {{ CSRF_TRUSTED_ORIGINS }}
- unless: /bin/bash -c "[ -f "{{ TETHYS_PERSIST }}/config_complete" ];"

{% if PREFIX_URL %}
Set_Prefix_URL_Tethys_Settings:
cmd.run:
- name: >
tethys settings --set PREFIX_URL {{ PREFIX_URL }}
- unless: /bin/bash -c "[ -f "{{ TETHYS_PERSIST }}/config_complete" ];"
{% endif %}

Sync_Apps:
cmd.run:
- name: tethys db sync
- shell: /bin/bash
- unless: /bin/bash -c "[ -f "{{ TETHYS_PERSIST }}/init_apps_setup_complete" ];"
- unless: /bin/bash -c "[ -f "{{ TETHYS_PERSIST }}/config_complete" ];"

Sync_App_Persistent_Stores:
cmd.run:
- name: tethys syncstores all
- shell: /bin/bash
- unless: /bin/bash -c "[ -f "${TETHYS_PERSIST}/init_apps_setup_complete" ];"
- unless: /bin/bash -c "[ -f "${TETHYS_PERSIST}/config_complete" ];"

Flag_Complete_Setup:
cmd.run:
- name: touch ${TETHYS_PERSIST}/init_apps_setup_complete
- name: touch ${TETHYS_PERSIST}/config_complete
- shell: /bin/bash
4 changes: 2 additions & 2 deletions salt/mde.sls
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Link_Persistent_Stores_Database_MDE:
Set_MDE_Settings:
cmd.run:
- name: >
tethys app_settings set metdataexplorer disclaimer_header {{ MDE_CS_DISCLAIMER_HEADER }} &&
tethys app_settings set metdataexplorer disclaimer_message {{ MDE_CS_DISCLAIMER_MESSAGE }}
tethys app_settings set metdataexplorer disclaimer_header "{{ MDE_CS_DISCLAIMER_HEADER }}" &&
tethys app_settings set metdataexplorer disclaimer_message "{{ MDE_CS_DISCLAIMER_MESSAGE }}"
- shell: /bin/bash
- unless: /bin/bash -c "[ -f "${TETHYS_PERSIST}/mde_complete" ];"
Expand Down

0 comments on commit b2aa8e0

Please sign in to comment.