apiVersion: v1
kind: ConfigMap
metadata:
  name: script-config-integration
  namespace: {{ .Release.Namespace }}
  labels:
    helm.sh/chart: {{ include "vault.chart" . }}
    app.kubernetes.io/name: {{ include "vault.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
  script-config.sh: |-
    #!/bin/sh

    vault_url=http://hashicorp-vault:8200

    #enable secret engine for noTrembita
    curl \
       --header "X-Vault-Token: $VAULT_ROOT_TOKEN" \
       --request POST \
       --data @/cfg/secret-engine/secret-engine.json \
       $vault_url/v1/sys/mounts/platform-integration

    #enable secret engine for customDns
    curl \
       --header "X-Vault-Token: $VAULT_ROOT_TOKEN" \
       --request POST \
       --data @/cfg/secret-engine/secret-engine.json \
       $vault_url/v1/sys/mounts/custom-dns-names

    #enable secret engine for smtp credentials
    curl \
       --header "X-Vault-Token: $VAULT_ROOT_TOKEN" \
       --request POST \
       --data @/cfg/secret-engine/secret-engine.json \
       $vault_url/v1/sys/mounts/registry-kv
