apiVersion: v1
kind: ConfigMap
metadata:
  name: nats-config
  namespace: nats-io
data:
  nats.conf: |-
    listen: 0.0.0.0:4222
    http: 0.0.0.0:8222

    #tls {
    #  cert_file:  "/etc/nats/tls/nats.pem"
    #  key_file:   "/etc/nats/tls/nats-key.pem"
    #  timeout:    2
    #}

    # Authorization for client connections
    #authorization {
    #   user:     nats_client_user
    #    # ./util/mkpasswd -p T0pS3cr3t
    #   password: nats_client_pwd
    #   timeout:  1
    #}

    # Cluster definition
    cluster {
        listen: 0.0.0.0:6222

        # Disabled this because peer-auth requires real SANS DNS in certificate
        #tls {
        #    cert_file:  "/etc/nats/tls/nats.pem"
        #    key_file:   "/etc/nats/tls/nats-key.pem"
        #    ca_file:    "/etc/nats/tls/ca.pem"
        #    timeout:    5
        #}

        # Authorization for route connections
        authorization {
           user: nats_route_user
           password: nats_route_pwd
           timeout: 0.5
        }

        # Routes are actively solicited and connected to from this server.
        # Other servers can connect to us if they supply the correct credentials
        # in their routes definitions from above.
        routes = [
            nats://nats_route_user:nats_route_pwd@nats-cluster:6222
        ]
    }

    # logging options
    debug:   false
    trace:   true
    logtime: true

    # Some system overides

    # max_connections
    max_connections: 100

    # maximum protocol control line
    max_control_line: 512

    # maximum payload
    max_payload: 65536

    # Duration the server can block on a socket write to a client.  Exceeding the
    # deadline will designate a client as a slow consumer.
    write_deadline: "2s"