|
1 | 1 | {{- define "snoty.baseConfig" -}} |
2 | 2 | {{- with $.Values.appConfig }} |
3 | 3 | environment: {{ .environment }} |
| 4 | + corsHosts: |
| 5 | + {{ range .corsHosts }} |
| 6 | + - {{ . | quote }} |
| 7 | + {{ end }} |
| 8 | + featureFlags: |
| 9 | + {{- toYaml .featureFlags | nindent 12 -}} |
| 10 | + {{- if and .featureFlags.flags (ne .featureFlags.type "InMemory") -}} |
| 11 | + {{- fail "Error: custom feature flag values are only supported when using the InMemory provider" -}} |
| 12 | + {{- end -}} |
4 | 13 | {{- end }} |
5 | 14 | {{- with $.Values.ingress }} |
6 | 15 | publicHost: {{ ternary "https" "http" .tls }}://{{ .hostname }}{{ .path }} |
7 | 16 | {{- end }} |
8 | | - database: |
9 | | - # if `appConfig.database` is set, it overrides the config from `postgresql`. |
10 | | - {{- if and $.Values.postgresql.deploy (not (kindIs "map" $.Values.appConfig.database)) }} |
11 | | - {{- with $.Values.postgresql }} |
12 | | - username: {{ .auth.username }} |
13 | | - password: {{ .auth.password }} |
14 | | - jdbcUrl: jdbc:postgresql://{{ $.Release.Name }}-postgresql:{{ .primary.service.ports.postgresql | default 5432 }}/{{ .auth.database }} |
| 17 | + mongodb: |
| 18 | + # if `appConfig.mongodb` is set, it overrides the config from `mongodb`. |
| 19 | + {{- if and $.Values.mongodb.deploy (not (kindIs "map" $.Values.appConfig.mongodb)) }} |
| 20 | + {{- with $.Values.mongodb }} |
| 21 | + {{- if .auth.existingSecret }} |
| 22 | + connection: |
| 23 | + type: Split |
| 24 | + srv: {{ eq .architecture "replicaset" }} |
| 25 | + host: {{ .service.nameOverride }}.{{ $.Release.Namespace }}.svc.{{ $.Values.clusterDomain }} |
| 26 | + port: {{ .service.ports.mongodb }} |
| 27 | + database: {{ index .auth.databases 0 }} |
| 28 | + additionalOptions: tls={{ .tls.enabled }}&ssl={{ .tls.enabled }} |
| 29 | + authentication: |
| 30 | + username: {{ index .auth.usernames 0 }} |
| 31 | + authDatabase: {{ index .auth.databases 0 }} |
| 32 | + # password is loaded from existingSecret |
| 33 | + {{- else }} |
| 34 | + connection: |
| 35 | + # does not support architecture=replicaset, prefer using externalSecret |
| 36 | + type: ConnectionString |
| 37 | + connectionString: mongodb://{{ index .auth.usernames 0 }}:{{ index .auth.passwords 0 }}@{{ $.Release.Name }}-mongodb/{{ index .auth.databases 0 }} |
15 | 38 | {{- end }} |
16 | | - {{- else }} |
17 | | - {{- with $.Values.appConfig.database }} |
18 | | - {{- if kindIs "string" .username }} |
19 | | - username: {{ .username }} |
20 | | - {{- end }} |
21 | | - {{- if kindIs "string" .password }} |
22 | | - password: {{ .password }} |
23 | 39 | {{- end }} |
24 | | - {{- if kindIs "string" .jdbcUrl }} |
25 | | - jdbcUrl: {{ .jdbcUrl }} |
| 40 | + {{- else }} |
| 41 | + {{- with $.Values.appConfig.mongodb }} |
| 42 | + {{- if kindIs "string" .connectionString }} |
| 43 | + connectionString: {{ .connectionString }} |
26 | 44 | {{- end }} |
27 | 45 | {{- end }} |
28 | 46 | {{- end }} |
29 | 47 | authentication: |
30 | 48 | {{- if $.Values.keycloak.deploy }} |
31 | 49 | {{- with $.Values.keycloak }} |
32 | | - serverUrl: {{ ternary "https" "http" .ingress.tls }}://{{ .ingress.hostname }}/{{ trimPrefix "/" ($.Values.appConfig.authentication.path | default .ingress.path) }} |
| 50 | + serverUrl: {{ ternary "https" "http" .ingress.tls }}://{{ .ingress.hostname }}/{{ trimPrefix "/" (($.Values.appConfig.authentication).path | default .ingress.path) }} |
33 | 51 | clientId: {{ $.Values.appConfig.authentication.clientId }} |
34 | 52 | clientSecret: {{ $.Values.appConfig.authentication.clientSecret }} |
35 | 53 | {{- end }} |
|
38 | 56 | {{- if kindIs "string" .serverUrl }} |
39 | 57 | serverUrl: {{ .serverUrl }}/{{ trimPrefix "/" (.path | default "") }} |
40 | 58 | {{- end }} |
| 59 | + {{- if kindIs "string" .issuerUrl }} |
| 60 | + issuerUrl: {{ .issuerUrl }}{{ trimSuffix "/" (.path | default "") }} |
| 61 | + {{- end }} |
41 | 62 | {{- if kindIs "string" .clientId }} |
42 | 63 | clientId: {{ .clientId }} |
43 | 64 | {{- end }} |
|
0 commit comments