File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,7 +78,9 @@ def setup_server(bert_e):
7878 'WTF_CSRF_SECRET_KEY' : secrets .token_hex (24 ),
7979 })
8080
81- app .wsgi_app = ReverseProxied (app .wsgi_app )
81+ app_prefix = os .getenv ('APP_PREFIX' , '/' )
82+
83+ app .wsgi_app = ReverseProxied (app .wsgi_app , app_prefix )
8284
8385 app .bert_e = bert_e
8486
Original file line number Diff line number Diff line change @@ -23,24 +23,12 @@ class ReverseProxied(object):
2323 - app: the WSGI application
2424
2525 """
26- def __init__ (self , app ):
26+ def __init__ (self , app , prefix = "" ):
2727 self .app = app
28+ self .prefix = prefix
2829
2930 def __call__ (self , environ , start_response ):
30- script_name = environ .get ('HTTP_X_SCRIPT_NAME' , None )
31- if script_name is not None :
32- environ ['SCRIPT_NAME' ] = script_name
33- path_info = environ ['PATH_INFO' ]
34- if path_info .startswith (script_name ):
35- path_info = path_info [len (script_name ):]
36- environ ['PATH_INFO' ] = path_info
37-
38- scheme = environ .get ('HTTP_X_SCHEME' , None )
39- if scheme is not None :
40- environ ['wsgi_url_scheme' ] = scheme
41-
42- server = environ .get ('HTTP_X_FORWARDED_SERVER' , None )
43- if server :
44- environ ['HTTP_HOST' ] = server
45-
31+ if environ ['PATH_INFO' ].startswith (self .prefix ):
32+ environ ['PATH_INFO' ] = environ ['PATH_INFO' ][len (self .prefix ):]
33+ environ ['SCRIPT_NAME' ] = self .prefix
4634 return self .app (environ , start_response )
Original file line number Diff line number Diff line change 2222 annotations :
2323 checksum/settings : {{ include (print $.Template.BasePath "/settings.yaml") . | sha256sum }}
2424 checksum/secret : {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
25+ checksum/env : {{ include (print $.Template.BasePath "/env.yaml") . | sha256sum }}
2526 spec :
2627 {{- if .Values.image.pullSecrets }}
2728 imagePullSecrets :
3637 envFrom :
3738 - secretRef :
3839 name : {{ template "fullname" $ }}
40+ {{- if .Values.deployment.env }}
41+ - configMapRef :
42+ name : {{ template "fullname" $ }}-env
43+ {{- end }}
3944 ports :
4045 - name : http
4146 containerPort : {{ .Values.deployment.servicePort }}
Original file line number Diff line number Diff line change 1+ {{- if .Values.deployment.env }}
2+ ---
3+ apiVersion : v1
4+ kind : ConfigMap
5+ metadata :
6+ name : {{ template "fullname" $ }}-env
7+ labels :
8+ app : {{ template "fullname" $ }}
9+ chart : " {{ .Chart.Name }}-{{ .Chart.Version }}"
10+ release : " {{ .Release.Name }}"
11+ heritage : " {{ .Release.Service }}"
12+ type : Opaque
13+ data :
14+ {{ .Values.deployment.env | toYaml | indent 2 }}
15+ {{- end }}
Original file line number Diff line number Diff line change @@ -313,6 +313,9 @@ image:
313313
314314# # Kubernetes deployment configuration
315315deployment :
316+ # Setup env vars on the deployment
317+ env : {}
318+ # MY_VAR: MY_VALUE
316319
317320 # # Configure extra options for liveness and readiness probes
318321 livenessProbe :
You can’t perform that action at this time.
0 commit comments