{{- $nameSpace := include "lowcoder.namespace" . -}} {{- $mongoUser := (and .Values.mongodb.auth.usernames (first .Values.mongodb.auth.usernames)) | default "" -}} {{- $mongoPassword := (and .Values.mongodb.auth.passwords (first .Values.mongodb.auth.passwords)) | default "" -}} {{- $mongoProtocol := ternary "mongodb+srv" "mongodb" .Values.mongodb.useSrv -}} {{- $mongoSSL := ternary "true" "false" .Values.mongodb.useSSL -}} {{- $lowcoderDatabase := first .Values.mongodb.auth.databases -}} {{- $mongoSecret := lookup "v1" "Secret" $nameSpace .Values.mongodb.auth.existingSecret | default dict -}} {{- $mongoSecretPassword := (index ($mongoSecret.data | default dict) "password" | default "" | b64dec) -}} {{- $mongoServicename := .Values.mongodb.service.nameOverride | default "" -}} {{- $externalUrl := .Values.mongodb.service.externalUrl -}} apiVersion: v1 kind: Secret type: Opaque metadata: name: {{ include "lowcoder.fullname" . }}-api-service labels: {{- include "lowcoder.labels" . | nindent 4 }} {{- with .Values.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} stringData: {{- if .Values.mongodb.enabled }} LOWCODER_MONGODB_URL: "{{ $mongoProtocol }}://{{ $mongoUser }}:{{ $mongoPassword }}@{{ $mongoServicename }}.{{ $nameSpace }}.svc.cluster.local/{{ $lowcoderDatabase }}?retryWrites=true&ssl=false" {{- else }} LOWCODER_MONGODB_URL: "{{ $mongoProtocol }}://{{ $mongoUser }}:{{ $mongoSecretPassword }}@{{ $externalUrl }}/{{ $lowcoderDatabase }}?retryWrites=true&ssl={{ $mongoSSL }}" {{- end }} LOWCODER_DB_ENCRYPTION_PASSWORD: {{ .Values.global.config.encryption.password | default "lowcoder.org" | quote }} LOWCODER_DB_ENCRYPTION_SALT: {{ .Values.global.config.encryption.salt | default "lowcoder.org" | quote }} LOWCODER_API_KEY_SECRET: "{{ .Values.global.config.apiKeySecret }}" LOWCODER_SUPERUSER_USERNAME: {{ .Values.global.config.superuser.username | default "admin@localhost" | quote }} LOWCODER_SUPERUSER_PASSWORD: {{ .Values.global.config.superuser.password | default "" | quote }} LOWCODER_NODE_SERVICE_SECRET: {{ .values.global.config.nodeServiceSecret | default "62e348319ab9f5c43c3b5a380b4d82525cdb68740f21140e767989b509ab0aa2" | quote }} LOWCODER_NODE_SERVICE_SECRET_SALT: {{ .values.global.config.nodeServiceSalt | default "lowcoder.org" | quote }}