# Copyright Broadcom, Inc. All Rights Reserved.
# SPDX-License-Identifier: APACHE-2.0

file:
  /opt/bitnami/keycloak/conf/keycloak.conf:
    exists: true
    filetype: file
    mode: "0644"
    contents:
    - /https-port.*{{ .Vars.containerPorts.https }}/
    - /log-console-output.*{{ .Vars.logging.output }}/
command:
  {{ if and .Vars.serviceAccount.create .Vars.automountServiceAccountToken }}
  check-sa:
    exec: cat /var/run/secrets/kubernetes.io/serviceaccount/token | cut -d '.' -f 2 | xargs -I '{}' echo '{}====' | fold -w 4 | sed '$ d' | tr -d '\n' | base64 -d
    exit-status: 0
    stdout:
    - /serviceaccount.*name.*{{.Env.BITNAMI_APP_NAME }}/
  {{ end }}
