Compare commits

..

2 commits

Author SHA1 Message Date
Micke Nordin b5cc15a319
layer0-web: Make sure that environment variables are set
If the corresponding secrets exist, we put them in the environment
2023-06-22 09:45:15 +02:00
Micke Nordin 6217109290
layer0-web: Set values from environment if they exist 2023-06-22 09:44:10 +02:00
2 changed files with 32 additions and 0 deletions

View file

@ -39,6 +39,18 @@ data:
{{- end }}
PROMETHEUS_MULTIPROC_DIR: "/tmp"
---
{{- range $domain := $domains }}
{{- $name := $domain.name -}}
{{- $upper_name := $name | upper | replace "." "_" -}}
{{- $client_id := printf "%s_%s" $upper_name "OAUTH_CLIENT_ID" }}
{{- $client_secret := printf "%s_%s" $upper_name "OAUTH_CLIENT_SECRET" }}
{{- if hasKey $.Values.environment $client_id }}
{{ set $domain "OAUTH_CLIENT_ID" (get $.Values.environment $client_id) }}
{{- end }}
{{- if hasKey $.Values.environment $client_secret }}
{{ set $domain "OAUTH_CLIENT_SECRET" (get $.Values.environment $client_secret) }}
{{- end }}
{{- end }}
apiVersion: v1
kind: ConfigMap
metadata:

View file

@ -35,6 +35,26 @@ spec:
mountPath: /srv/domains.json
subPath: domains.json
readOnly: true
{{- if.Values.global.domains }}
env:
{{- range $domain := .Values.global.domains }}
{{- $name := $domain.name -}}
{{- $upper_name := upper $name | replace "." "_" -}}
{{- $lower_name := lower $name | replace "." "-" -}}
{{- $client_id := printf "%s_%s" $upper_name "OAUTH_CLIENT_ID" }}
{{- $client_secret := printf "%s_%s" $upper_name "OAUTH_CLIENT_SECRET" }}
- name: {{ $client_id }}
valueFrom:
secretKeyRef:
name: layer1-port-owncloud-{{ $lower_name }}
key: oauth-client-id
- name: {{ $client_secret }}
valueFrom:
secretKeyRef:
name: layer1-port-owncloud-{{ $lower_name }}
key: oauth-client-secret
{{- end }}
{{- end }}
envFrom:
- configMapRef:
name: mservice