---

client_web_origin_connect: "{{ http_s }}://{{ connect_base_url }}"
client_web_origin_wordpress: "{{ http_s }}://{{ wordpress_base_url }}"
client_web_origin_connect_external: "{{ http_s }}://{{ connect_external_subdomain | default('unset') }}.{{ domain }}"

current_realm_clients: [
  {
    name: "{{ connect_client_id }}",
    clientId: "{{ connect_client_id }}",
    admin_url: "",
    root_url: "",
    redirect_uris: "{{
      [client_web_origin_connect + '/*'] +
      ([client_web_origin_wordpress + '/*'] if 'connect_wordpress' in groups else []) +
      ([client_web_origin_connect_external + '/*'] if connect_external_subdomain is defined else [])
    }}",
    secret: '{{ connect_client_id }}',
    web_origins: "{{
      [client_web_origin_connect] +
      ([client_web_origin_wordpress] if 'connect_wordpress' in groups else []) +
      ([client_web_origin_connect_external] if connect_external_subdomain is defined else [])
    }}",
  }
]

current_realm_users_base:
  - username: "{{ connect_client_admin_username }}"
    password: "{{ connect_client_admin_password }}"

current_realm_users_wordpress:
  - username: "{{ connect_wordpress_buergerportal_username | default() }}"
    password: "{{ connect_wordpress_buergerportal_password | default() }}"

current_realm_users: >-
  {%- if 'connect_wordpress' in groups -%}
  [{{ current_realm_users_base + current_realm_users_wordpress }}]
  {%- else -%}
  [{{ current_realm_users_base }}]
  {%- endif -%}

current_realm_admin_users: []
