apiVersion: v1
kind: ConfigMap
metadata:
  name: ory-hydra
  labels:
    app: ory-hydra
data:
  DB_HOST: "mariadb"
  DB_NAME: "hydra"
  DB_USERNAME: "hydra"
  hydra.yaml.template: |
    dsn: mysql://${DB_USERNAME}:banana@tcp(${DB_HOST}:3306)/${DB_NAME}
    secrets:
      system:
        - ${SECRETS_SYSTEM}
    urls:
      self:
        issuer: https://hydra.##FAF_BASE_DOMAIN##
      login: https://user.##FAF_BASE_DOMAIN##/oauth2/login
      consent: https://user.##FAF_BASE_DOMAIN##/oauth2/consent

    # Static configuration
    strategies:
      access_token: jwt

    oauth2:
      client_credentials:
        default_grant_allowed_scope: true
  # Configuration shell script
  build-config.sh: |
    #!/bin/sh
    cat /config/hydra.yaml.template | envsubst > /pod/hydra.yaml
