---
run_tasks: true
# Import domino_oidc_debug from domino_oidc role if not defined
domino_oidc_debug: "{{ domino_oidc_debug | default(false) }}"
nomadweb_version: 1.0.15
nomadweb_version_major: "{{ nomadweb_version.split('.')[0] }}"
nomadweb_version_minor: "{{ nomadweb_version.split('.')[1] }}"
nomadweb_version_patch: "{{ nomadweb_version.split('.')[2] }}"

# Archive names for different versions
nomadweb_archive_domino14: "nomad-server-{{ nomadweb_version }}-for-domino-{{ domino_version_major }}.0.0-linux.tgz"
nomadweb_archive_domino12: "nomad-server-{{ nomadweb_version }}-for-domino-{{ domino_version_major }}.0.2-linux.tgz"
nomadweb_archive_newer: "nomad-server-{{ nomadweb_version }}-linux.tar.gz"

# Set the archive name based on version conditions
nomadweb_archive: "{{ nomadweb_archive_domino14 if (nomadweb_version is version('1.0.13', '<') and domino_version_major == 14) else 
                      nomadweb_archive_domino12 if (nomadweb_version is version('1.0.13', '<') and domino_version_major == 12) else 
                      nomadweb_archive_newer }}"

nomadweb_debug: false
nomadweb_app_switcher_enabled: true

nomad_hotfix_install: false
nomad_hotfix_version: "IF1"
nomad_hotfix_archive: "HCL_Nomad_server_{{ nomadweb_version }}-{{ nomad_hotfix_version }}_linux.tar.gz"
installer_url_app_path: "Super.Human.Installer/Nomad"
domino_nomadweb_port_forwards:
  -
    guest: 9443
    url: "notes"
domino_nomadweb_use_proxy_url: true
domino_nomadweb_proxy_url: "{{ domino_nomadweb_port_forwards[0].url }}.{{ settings.hostname }}.{{ settings.domain }}"

nomad_client_config:
  friendly_name: "Nomad server on Domino"
  client_id: "{{ domino_oidc_client_id }}"
  client_secret: "{{ domino_oidc_client_secret }}"
  redirect_uri: "https://{{ domino_nomadweb_proxy_url }}/login/callback"
  aud: "{% if domino_oidc_provider_federation_enabled %}{{ domino_organization }}-O={{ id_vault_name }}{% else %}https://{{ domino_nomadweb_proxy_url }}{% endif %}"
  scope: "{% if domino_oidc_provider_federation_enabled %}openid email Domino.user.all Domino.vault.{{ domino_organization }}-O={{ id_vault_name }}{% else %}openid email Domino.user.all{% endif %}"
  token_endpoint_auth_method: "client_secret_basic"
  access_token_sec: 300
  id_token_sec: 900
  refresh_token_sec: 3600
  max_session_sec: 57600
  id_token_signed_response_alg: "ES256"
  access_token_signed_response_alg: "ES256"

nomad_app_switcher_enabled_services:
 - WelcomePage
 - ServerConsole
 - DominoWeb
 - Guacamole
 - "{{ 'RestAPI' if 'startcloud.hcl_roles.domino_rest_api' in (enabled_roles | default([])) }}"
 - "{{ 'Sametime' if 'startcloud.hcl_roles.domino_sametime' in (enabled_roles | default([])) }}"
 - "{{ 'Traveler' if 'startcloud.hcl_roles.domino_traveler' in (enabled_roles | default([])) }}"
 - "{{ 'Leap' if 'startcloud.hcl_roles.domino_leap' in (enabled_roles | default([])) }}"
 - "{{ 'Verse' if 'startcloud.hcl_roles.domino_verse' in (enabled_roles | default([])) }}"
