main.ymlΒΆ

---
application_id: "web-app-listmonk"
entity_name: "{{ application_id | entity_name }}"
container_port: "{{ lookup('config', application_id, 'services.listmonk.ports.internal.http') }}"

LISTMONK_ADMIN_USERNAME: "{{ lookup('users', 'platform_administrator').username }}"
LISTMONK_ADMIN_PASSWORD: "{{ lookup('users', 'platform_administrator').password }}"
LISTMONK_ADMIN_EMAIL: "{{ lookup('users', 'platform_administrator').email }}"

LISTMONK_NAME: "{{ lookup('config', application_id, 'services.listmonk.name') }}"
LISTMONK_CONFIG_HOST: "{{ [ lookup('container', application_id, 'directories.config'),'config.toml' ] | path_join }}"
LISTMONK_OIDC_ENABLED: "{{ lookup('config', application_id, 'services.sso.enabled') }}"

LISTMONK_PUBLIC_API_ENABLED: "{{ lookup('config', application_id, 'services.listmonk.public_api_activated') }}"

LISTMONK_USER_SEND: "newsletter"
LISTMONK_USER_BOUNCE: "bounce"

LISTMONK_EXEC_DATABASE: "container exec -i -e LISTMONK_REALIGN_PASSWORD {{ lookup('database', application_id, 'address') }} psql -U {{ lookup('database', application_id,
  'username') }} -d {{ lookup('database', application_id, 'name') }}"
LISTMONK_EMAIL: "{{ lookup('email', application_id) }}"

LISTMONK_SETTINGS:
  - key: "app.root_url"
    value: "\"{{ lookup('tls', application_id, 'url.base') }}\""

  - key: "app.notify_emails"
    value: "{{ [ lookup('users', 'platform_administrator').email ] | to_json }}"

  - key: "security.oidc"
    value: >-
      {{ {
         "enabled": True,
         "client_id": OIDC.CLIENT.ID,
         "provider_url": OIDC.CLIENT.ISSUER_URL,
         "client_secret": OIDC.CLIENT.SECRET
      } | to_json }}
    condition: "{{ LISTMONK_OIDC_ENABLED | bool }}"

  - key: "appearance.public.custom_js"
    value: "{{ lookup('file', lookup('path_absolute', 'roles/web-app-listmonk/files/javascript/oidc-autologin.js')) | to_json }}"
    condition: "{{ LISTMONK_OIDC_ENABLED | bool }}"

  - key: "security.enable_captcha"
    value: "true"

  - key: "security.captcha_key"
    value: "\"{{ lookup('config', application_id, 'secrets.credentials.hcaptcha.key') }}\""

  - key: "security.captcha_secret"
    value: "\"{{ lookup('config', application_id, 'secrets.credentials.hcaptcha.secret') }}\""

  - key: "smtp"
    value: >-
      {{ [
        {
          "host":            LISTMONK_EMAIL.host,
          "port":            LISTMONK_EMAIL.port,
          "enabled":         LISTMONK_EMAIL.smtp,
          "username":        lookup('users', LISTMONK_USER_SEND).email,
          "password":        lookup('users', LISTMONK_USER_SEND).password,
          "tls_type":        (
                                LISTMONK_EMAIL.tls
                                | ternary("TLS",
                                    LISTMONK_EMAIL.start_tls
                                      | ternary("STARTTLS","NONE")
                                  )
                              ),
          "email_headers":   [],
          "hello_hostname":  "",
          "max_conns":       10,
          "idle_timeout":    "15s",
          "wait_timeout":    "5s",
          "auth_protocol":   "login",
          "max_msg_retries": 2,
          "tls_skip_verify": false
        }
      ] | to_json }}
    condition: "{{ LISTMONK_EMAIL.smtp | bool }}"

  - key: "app.lang"
    value: '"{{ HOST_LL }}"'

  - key: "bounce.enabled"
    value: "true"

  - key: "bounce.mailboxes"
    value: >-
      {{ [
        {
          "host":            LISTMONK_EMAIL.host,
          "port":            995,
          "type":            "pop",
          "uuid":            "471fd0e9-8c33-4e4a-9183-c4679699faca",
          "enabled":         true,
          "username":        lookup('users', LISTMONK_USER_BOUNCE).email,
          "password":        lookup('users', LISTMONK_USER_BOUNCE).get('tokens', {}).get(MAIL_PROVIDER, ''),
          "return_path":     lookup('users', LISTMONK_USER_BOUNCE).email,
          "tls_enabled":     LISTMONK_EMAIL.tls,
          "auth_protocol":   "userpass",
          "scan_interval":   "15m",
          "tls_skip_verify": false
        }
      ] | to_json }}

  - key: "app.from_email"
    value: '"{{ service_provider.company.titel }} Newsletter <{{ lookup(''users'', LISTMONK_USER_SEND).email }}>"'

  - key: "app.check_updates"
    value: "true"

  - key: "app.enable_public_archive_rss_content"
    value: "true"

  - key: "upload.provider"
    value: '"s3"'
    condition: "{{ lookup('objstore', application_id, 'enabled') | bool }}"

  - key: "upload.s3.aws_access_key_id"
    value: "{{ lookup('objstore', application_id, 'access_key') | to_json }}"
    condition: "{{ lookup('objstore', application_id, 'enabled') | bool }}"

  - key: "upload.s3.aws_secret_access_key"
    value: "{{ lookup('objstore', application_id, 'secret_key') | to_json }}"
    condition: "{{ lookup('objstore', application_id, 'enabled') | bool }}"

  - key: "upload.s3.aws_default_region"
    value: "{{ lookup('objstore', application_id, 'region') | to_json }}"
    condition: "{{ lookup('objstore', application_id, 'enabled') | bool }}"

  - key: "upload.s3.bucket"
    value: "{{ lookup('objstore', application_id, 'bucket') | to_json }}"
    condition: "{{ lookup('objstore', application_id, 'enabled') | bool }}"

  - key: "upload.s3.url"
    value: "{{ lookup('objstore', application_id, 'url') | to_json }}"
    condition: "{{ lookup('objstore', application_id, 'enabled') | bool }}"

  - key: "upload.s3.public_url"
    value: "{{ lookup('objstore', application_id, 'public_url') | to_json }}"
    condition: "{{ lookup('objstore', application_id, 'enabled') | bool }}"

  - key: "upload.s3.bucket_type"
    value: '"public"'
    condition: "{{ lookup('objstore', application_id, 'enabled') | bool }}"

LISTMONK_DESIGN: "{{ lookup('design', application_id) }}"
LISTMONK_DESIGN_ENABLED: "{{ lookup('config', application_id, 'services.design.enabled') | bool }}"
LISTMONK_DESIGN_CSS_MARKER: ":root{--infinito-design-carrier:1}"
LISTMONK_DESIGN_JS_MARKER: "window.infinitoDesignCarrier = 1;"
LISTMONK_DESIGN_APPEARANCE:
  - key: "appearance.admin.custom_css"
    template: "design/admin.css.j2"
    marker: "{{ LISTMONK_DESIGN_CSS_MARKER }}"
  - key: "appearance.admin.custom_js"
    template: "design/admin.js.j2"
    marker: "{{ LISTMONK_DESIGN_JS_MARKER }}"
  - key: "appearance.public.custom_css"
    template: "design/public.css.j2"
    marker: "{{ LISTMONK_DESIGN_CSS_MARKER }}"
LISTMONK_DESIGN_BRANDING:
  - key: "app.logo_url"
    design: "{{ LISTMONK_DESIGN.urls.header.svg }}"
    fallback: "{{ service_provider.platform.logo }}"
  - key: "app.favicon_url"
    design: "{{ LISTMONK_DESIGN.urls.favicon_ico }}"
    fallback: "{{ service_provider.platform.favicon }}"
  - key: "app.site_name"
    design: "{{ LISTMONK_DESIGN.label }}"
    fallback: "{{ service_provider.company.titel }} Mailing list"

LISTMONK_MCP_ENABLED: "{{ lookup('config', application_id, 'services.listmonkmcp.enabled') | bool }}"
LISTMONK_MCP_SERVICE_KEY: "listmonkmcp"
LISTMONK_MCP_CONTAINER: "{{ lookup('config', application_id, 'services.listmonkmcp.name') }}"
LISTMONK_MCP_PORT: "{{ lookup('config', application_id, 'services.listmonkmcp.ports.internal.http') }}"
LISTMONK_MCP_BEARER: "{{ lookup('config', application_id, 'secrets.credentials.mcp_bearer') }}"
LISTMONK_MCP_INSTANCE_DIR: "{{ [lookup('container', application_id, 'directories.instance'), 'mcp'] | path_join }}"
LISTMONK_MCP_UPSTREAM_HOST: "{{ lookup('config', application_id, 'services.listmonk.name') }}"
LISTMONK_MCP_UPSTREAM_PORT: "{{ lookup('config', application_id, 'services.listmonk.ports.internal.http') }}"
LISTMONK_MCP_UPSTREAM_URL: "http://{{ LISTMONK_MCP_UPSTREAM_HOST }}:{{ LISTMONK_MCP_UPSTREAM_PORT }}"
LISTMONK_MCP_CONTRACT:
  provider: "{{ application_id }}"
  upstream_url: "{{ LISTMONK_MCP_UPSTREAM_URL }}"
  auth_subject: "{{ lookup('config', application_id, 'mcp.auth_subject') }}"
  mutating_tools_enabled: "{{ lookup('config', application_id, 'mcp.tools.mutating_tools_enabled') | bool }}"
  tools: "{{ lookup('file', 'mcp/tools.json') | from_json }}"
  limits: "{{ lookup('config', application_id, 'mcp.limits') }}"
  schema_sha256: "{{ lookup('config', application_id, 'mcp.tools.schema_sha256') }}"
LISTMONK_MCP_UPSTREAM_KEY: "{{ lookup('config', application_id, 'secrets.credentials.mcp_upstream_token') }}"
LISTMONK_MCP_UPSTREAM_USER: "mcpreader"
LISTMONK_MCP_UPSTREAM_ROLE: "mcp-readonly"
LISTMONK_MCP_UPSTREAM_AUTH_HEADER: "Authorization"
LISTMONK_MCP_UPSTREAM_AUTH_FORMAT: "token {{ LISTMONK_MCP_UPSTREAM_USER }}:{key}"