{{- $nacos := .Values -}}
{{- if eq $nacos.storage.type "mysql" }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: nacos-db-config
  namespace: {{ .Release.Namespace }}
  labels:
    app: nacos
    dubbo.io/rev: {{ default "default" | quote }}
    install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
    operator.dubbo.io/component: "Nacos"
    dubbo: nacos
    release: {{ .Release.Name }}
    app.kubernetes.io/name: "register"
data:
  {{- with $nacos.storage  }}
  mysql.db.host: {{ .database.host }}
  mysql.db.name: {{ .database.name }}
  mysql.port: "{{ .database.port | default 3306 }}"
  mysql.user: {{ .database.username }}
  mysql.password: {{ .database.password }}
  mysql.param: {{ .database.param | default "characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true" }}
  {{- end -}}
  {{- end -}}