{{- if or .Values.azureKeyVault.createSecret .Values.jwt.createSecret .Values.hmac.createSecret }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "freeleaps-secret-operator.fullname" . }}-config
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "freeleaps-secret-operator.labels" . | nindent 4 }}
type: Opaque
data:
  {{- if .Values.azureKeyVault.createSecret }}
  AZURE_TENANT_ID: {{ .Values.azureKeyVault.credentials.tenantId | b64enc | quote }}
  AZURE_CLIENT_ID: {{ .Values.azureKeyVault.credentials.clientId | b64enc | quote }}
  AZURE_CLIENT_SECRET: {{ .Values.azureKeyVault.credentials.clientSecret | b64enc | quote }}
  AZURE_VAULT_URL: {{ .Values.azureKeyVault.credentials.vaultUrl | b64enc | quote }}
  AZURE_VAULT_NAME: {{ .Values.azureKeyVault.credentials.vaultName | b64enc | quote }}
  AZURE_SUBSCRIPTION_ID: {{ .Values.azureKeyVault.credentials.subscriptionId | b64enc | quote }}
  AZURE_RESOURCE_GROUP: {{ .Values.azureKeyVault.credentials.resourceGroup | b64enc | quote }}
  {{- end }}
  {{- if .Values.jwt.createSecret }}
  JWT_SECRET_KEY: {{ .Values.jwt.config.secretKey | b64enc | quote }}
  JWT_ALGORITHM: {{ .Values.jwt.config.algorithm | b64enc | quote }}
  {{- end }}
  {{- if .Values.hmac.createSecret }}
  HMAC_SECRET_KEY: {{ .Values.hmac.config.secretKey | b64enc | quote }}
  {{- end }}
{{- end }}
