---
apiVersion: v1
kind: ConfigMap
metadata:
  name: stan-config
data:
  # yamllint disable rule:indentation
  stan.conf: |
    port: 4222
    http: 8222

    tls: {
      ca_file: "/etc/nats/certs/ca.crt",
      cert_file: "/etc/nats/certs/server.crt",
      key_file: "/etc/nats/certs/server.key",
      timeout: 3
    }

    streaming: {
      id: pl-stan
      ns: "nats://pl-nats:4222"
      store: file
      dir: /data/stan/store
      store_limits: {
        max_age: "24h"
        max_channels: 0
        max_inactivity: "24h"
        max_subscriptions: 0
        channels: {
          "v2c.>": {
            max_age: "15m"
          }
        }
      }
      tls: {
        client_ca: "/etc/nats/certs/ca.crt",
        client_cert: "/etc/nats/certs/server.crt",
        client_key: "/etc/nats/certs/server.key",
        timeout: 3
      }
      cluster: {
        node_id: $POD_NAME
        log_path: /data/stan/log
        # Explicit names of resulting peers
        peers: ["pl-stan-0", "pl-stan-1", "pl-stan-2"]
      }
    }
  # yamllint enable rule:indentation
