main.ymlΒΆ

---
application_id: "web-app-erpnext"
entity_name: "{{ application_id | entity_name }}"

ERPNEXT_BACKEND_CONTAINER: "{{ lookup('config', application_id, 'services.backend.name') }}"
ERPNEXT_FRONTEND_CONTAINER: "{{ lookup('config', application_id, 'services.frontend.name') }}"
ERPNEXT_WEBSOCKET_CONTAINER: "{{ lookup('config', application_id, 'services.websocket.name') }}"
ERPNEXT_SCHEDULER_CONTAINER: "{{ lookup('config', application_id, 'services.scheduler.name') }}"
ERPNEXT_QUEUE_SHORT_CONTAINER: "{{ lookup('config', application_id, 'services.queue-short.name') }}"
ERPNEXT_QUEUE_LONG_CONTAINER: "{{ lookup('config', application_id, 'services.queue-long.name') }}"
ERPNEXT_CONFIGURATOR_CONTAINER: "{{ lookup('config', application_id, 'services.configurator.name') }}"

ERPNEXT_BACKEND_PORT: "{{ lookup('config', application_id, 'services.backend.ports.internal.http') }}"
ERPNEXT_WEBSOCKET_PORT: "{{ lookup('config', application_id, 'services.websocket.ports.internal.socketio') }}"

ERPNEXT_HOSTNAME: "{{ lookup('domain', application_id) }}"
ERPNEXT_SITE_NAME: "{{ ERPNEXT_HOSTNAME }}"

ERPNEXT_SITES_DIR: "{{ lookup('volume', application_id, 'sites').target }}"
ERPNEXT_BENCH_PYTHON: "bash -c 'cd {{ ERPNEXT_SITES_DIR }} && {{ ERPNEXT_SITES_DIR | dirname }}/env/bin/python -'"

ERPNEXT_INITIAL_ADMIN_PASSWORD: "{{ lookup('config', application_id, 'secrets.credentials.initial_admin_password') }}"
ERPNEXT_API_BOT_PASSWORD: "{{ ERPNEXT_API_BOT_USER.password }}"
ERPNEXT_API_KEY_SECRET: "{{ lookup('config', application_id, 'secrets.credentials.api_key_secret') }}"

ERPNEXT_API_BOT_USER: "{{ lookup('users', 'erpnext-api-bot') }}"
ERPNEXT_API_BOT_EXTRA_ROLES: "{{ lookup('config', application_id, 'services.erpnext.api_bot.extra_roles') }}"

ERPNEXT_COMPANY_NAME: "{{ service_provider.company.titel }}"
ERPNEXT_COMPANY_ABBR: "{{ lookup('config', application_id, 'services.erpnext.company.abbr') }}"
ERPNEXT_COMPANY_COUNTRY: "{{ service_provider.company.address.country }}"

ERPNEXT_SERVER_SCRIPTS_ENABLED: "{{ lookup('config', application_id, 'services.erpnext.server_scripts') | bool }}"

ERPNEXT_OIDC_ENABLED: "{{ lookup('config', application_id, 'services.sso.enabled')   | bool }}"
ERPNEXT_LDAP_ENABLED: "{{ lookup('config', application_id, 'services.ldap.enabled')  | bool }}"
ERPNEXT_EMAIL_ENABLED: "{{ lookup('config', application_id, 'services.email.enabled') | bool }}"

ERPNEXT_DESIGN_ENABLED: "{{ lookup('config', application_id, 'services.design.enabled') | bool }}"
ERPNEXT_DESIGN_LOGO_ENABLED: "{{ ERPNEXT_DESIGN_ENABLED | bool and lookup('design', application_id).logo is string }}"
ERPNEXT_DESIGN_TITLE: "{{ lookup('design', application_id).title if ERPNEXT_DESIGN_ENABLED | bool and lookup('design', application_id).title is string else '' }}"
ERPNEXT_DESIGN_LOGO_URL: "{{ lookup('design', application_id).urls.logo.svg if ERPNEXT_DESIGN_LOGO_ENABLED | bool else '' }}"
ERPNEXT_DESIGN_FAVICON_URL: "{{ lookup('design', application_id).urls.favicon_ico if ERPNEXT_DESIGN_LOGO_ENABLED | bool else '' }}"

ERPNEXT_DB_HOST: "{{ lookup('database', application_id, 'host') }}"
ERPNEXT_DB_PORT: "{{ lookup('database', application_id, 'port') }}"

ERPNEXT_DB_ROOT_USER: "root"
ERPNEXT_DB_ROOT_PASSWORD: >-
  {{ lookup('config', 'svc-db-mariadb', 'secrets.credentials.root_password')
     if (lookup('config', application_id, 'services.mariadb.shared') | bool)
     else lookup('database', application_id, 'password') }}

ERPNEXT_REDIS_URL: "{{ lookup('engine', 'redis', application_id, 'url') }}"

ERPNEXT_MAIL: "{{ lookup('email', application_id) if ERPNEXT_EMAIL_ENABLED else {} }}"

ERPNEXT_OIDC_ROLE_GRANTS:
  administrator:
    - "System Manager"
  manager:
    - "Sales User"
    - "Purchase User"
    - "Stock User"
    - "Accounts User"
  customer:
    - "Customer"
ERPNEXT_OIDC_GROUP_ROLE_MAP: >-
  {{ {
       '/' ~ lookup('rbac_group_path', application_id=application_id, role='administrator'): ERPNEXT_OIDC_ROLE_GRANTS.administrator,
       '/' ~ lookup('rbac_group_path', application_id=application_id, role='manager'): ERPNEXT_OIDC_ROLE_GRANTS.manager,
       '/' ~ lookup('rbac_group_path', application_id=application_id, role='customer'): ERPNEXT_OIDC_ROLE_GRANTS.customer,
     } }}