Skip to content

Commit 547ad3f

Browse files
committed
chore(backend): set database.type appropriately
1 parent bcd14f9 commit 547ad3f

File tree

2 files changed

+30
-24
lines changed

2 files changed

+30
-24
lines changed

backend/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: backend
3-
version: 0.5.0
3+
version: 0.6.0
44
description: Backend of the Snoty application suite
55
type: application
66
home: https://snoty.me
@@ -12,7 +12,7 @@ maintainers:
1212
1313
url: https://github.com/SIMULATAN
1414
icon: https://avatars.githubusercontent.com/u/163506575
15-
appVersion: "0.0.1-242"
15+
appVersion: "0.2.0"
1616
dependencies:
1717
- name: common
1818
version: 2.x.x

backend/templates/_config.tpl

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,31 @@
1414
{{- with $.Values.ingress }}
1515
publicHost: {{ ternary "https" "http" .tls }}://{{ .hostname }}{{ trimSuffix "/" .path }}
1616
{{- end }}
17-
mongodb:
1817
# if `appConfig.mongodb` is set, it overrides the config from `mongodb`.
1918
{{- 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 }}
38-
{{- end }}
39-
{{- end }}
19+
database:
20+
type: mongodb
21+
{{- with $.Values.mongodb }}
22+
{{- if .auth.existingSecret }}
23+
mongodb:
24+
connection:
25+
type: Split
26+
srv: {{ eq .architecture "replicaset" }}
27+
host: {{ .service.nameOverride }}.{{ $.Release.Namespace }}.svc.{{ $.Values.clusterDomain }}
28+
port: {{ .service.ports.mongodb }}
29+
database: {{ index .auth.databases 0 }}
30+
additionalOptions: tls={{ .tls.enabled }}&ssl={{ .tls.enabled }}
31+
authentication:
32+
username: {{ index .auth.usernames 0 }}
33+
authDatabase: {{ index .auth.databases 0 }}
34+
# password is loaded from existingSecret
35+
{{- else }}
36+
connection:
37+
# does not support architecture=replicaset, prefer using externalSecret
38+
type: ConnectionString
39+
connectionString: mongodb://{{ index .auth.usernames 0 }}:{{ index .auth.passwords 0 }}@{{ $.Release.Name }}-mongodb/{{ index .auth.databases 0 }}
40+
{{- end }}
41+
{{- end }}
4042
{{- else }}
4143
{{- with $.Values.appConfig.mongodb }}
4244
{{- if kindIs "string" .connectionString }}
@@ -82,7 +84,7 @@
8284
'-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend={{ .Values.appConfig.jvmDebug.suspend | ternary "y" "n" }}'
8385
{{ end }}
8486

85-
{{ if kindIs "map" .Values.mongodb.auth }}
87+
{{ if and (.Values.mongodb.deploy) (kindIs "map" .Values.mongodb.auth) }}
8688
{{- with .Values.mongodb.auth -}}
8789
{{- if .existingSecret -}}
8890
- name: mongodb.authentication.password
@@ -110,6 +112,9 @@
110112
key: {{ .clientSecret.secretKey | default "clientSecret" }}
111113
{{- end -}}
112114
{{- end -}}
115+
{{- if kindIs "map" .sql }}
116+
- name: database.type
117+
value: sql
113118
{{- with .sql -}}
114119
{{- if kindIs "map" .username }}
115120
- name: sql.username
@@ -135,3 +140,4 @@
135140
{{- end -}}
136141
{{- end -}}
137142
{{- end -}}
143+
{{- end -}}

0 commit comments

Comments
 (0)