apiVersion: v1
kind: ConfigMap
metadata:
  name: "postiz-temporal-config"
  labels:
    app.kubernetes.io/name: temporal
    helm.sh/chart: temporal-1.2.0
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/instance: postiz
    app.kubernetes.io/version: "1.31.0"
    app.kubernetes.io/part-of: temporal
data:
  config_template.yaml: |-
    # enable-template
    log:
      stdout: true
      level: "debug,info"

    persistence:
      datastores:
        default:
          sql:
            connectAddr: postiz-postgresql-18-cluster-rw.postiz:5432
            connectProtocol: tcp
            databaseName: temporal
            driverName: postgres12
            password: {{ env "TEMPORAL_DEFAULT_STORE_PASSWORD" | quote }}
            pluginName: postgres12
            tls:
              enabled: false
            user: postgres
        visibility:
          sql:
            connectAddr: postiz-postgresql-18-cluster-rw.postiz:5432
            connectProtocol: tcp
            databaseName: temporal_visibility
            driverName: postgres12
            password: {{ env "TEMPORAL_VISIBILITY_STORE_PASSWORD" | quote }}
            pluginName: postgres12
            tls:
              enabled: false
            user: postgres
      defaultStore: default
      numHistoryShards: 512
      visibilityStore: visibility

    global:
      membership:
        name: temporal
        maxJoinDuration: 30s
        broadcastAddress: {{ env "POD_IP" | quote }}

      pprof:
        port: 7936

      metrics:
        tags:
          type: {{ env "TEMPORAL_SERVICES" | quote }}
        prometheus:
          listenAddress: 0.0.0.0:9090
          timerType: histogram

    services:
      frontend:
        rpc:
          grpcPort: 7233
          httpPort: 7243
          membershipPort: 6933
          bindOnIP: "0.0.0.0"

      history:
        rpc:
          grpcPort: 7234
          membershipPort: 6934
          bindOnIP: "0.0.0.0"

      matching:
        rpc:
          grpcPort: 7235
          membershipPort: 6935
          bindOnIP: "0.0.0.0"

      worker:
        rpc:
          membershipPort: 6939
          bindOnIP: "0.0.0.0"

    clusterMetadata:
      enableGlobalNamespace: false
      failoverVersionIncrement: 10
      masterClusterName: "active"
      currentClusterName: "active"
      clusterInformation:
        active:
          enabled: true
          initialFailoverVersion: 1
          rpcName: "temporal-frontend"
          rpcAddress: "127.0.0.1:7233"
          httpAddress: "127.0.0.1:7243"

    dcRedirectionPolicy:
      policy: "noop"
      toDC: ""

    archival:
      status: "disabled"
    publicClient:
      hostPort: "postiz-temporal-frontend:7233"

    dynamicConfigClient:
      filepath: "/etc/temporal/dynamic_config/dynamic_config.yaml"
      pollInterval: "10s"
