apiVersion: v1
kind: ConfigMap
metadata:
  name: keycloak
  namespace: keycloak
  labels:
    app: keycloak
    component: keycloak
data:
  keycloak.cli: |
    embed-server --std-out=echo
    # Makes node identifier unique getting rid of a warning in the logs
    /subsystem=transactions:write-attribute(name=node-identifier, value=${jboss.node.name})
    # Allow log level to be configured via environment variable
    /subsystem=logging/console-handler=CONSOLE:write-attribute(name=level, value=${env.WILDFLY_LOGLEVEL:INFO})
    /subsystem=logging/root-logger=ROOT:write-attribute(name=level, value=${env.WILDFLY_LOGLEVEL:INFO})
    # Log only to console
    /subsystem=logging/root-logger=ROOT:write-attribute(name=handlers, value=[CONSOLE])

    stop-embedded-server
  keycloak.sh: |
    #!/usr/bin/env bash
    set -eu
    /opt/jboss/keycloak/bin/jboss-cli.sh --file=/scripts/keycloak.cli
    exec /opt/jboss/tools/docker-entrypoint.sh -b 0.0.0.0
    exit "$?"


