# Configuration

# Introduction

The configuration files of NanoMQ Broker usually have the suffix .conf. You can find these configuration files in the etc directory.

FileDescription
etc/nanomq.confNanoMQ Configuration File
etc/nanomq_bridge.confNanoMQ Bridge File
etc/nanomq_auth_username.confNanoMQ Authorization File
etc/nanomq_web_hook.confNanoMQ Web Hook File

# Parameter Description

# nanomq.conf

NameTypeDescription
urlStringUrl of listener.
num_taskq_threadIntegerNumber of taskq threads used.
max_taskq_threadIntegerMaximum number of taskq threads used.
parallelLongNumber of parallel.
property_sizeIntegerMax size for a MQTT property.
msq_lenIntegerQueue length for resending messages.
qos_durationIntegerThe interval of the qos timer.
allow_anonymousBooleanAllow anonymous login.
tls.enableBooleanEnable TLS listener(default: false).
tls.urlStringURL of TLS listener.
tls.keyStringUser's private PEM-encoded key.
tls.keypassStringString containing the user's password. Only used if the private keyfile is password-protected.
tls.certStringUser certificate data.
tls.cacertStringUser's PEM-encoded CA certificates.
tls.verify_peerBooleanVerify peer certificate.
tls.fail_if_no_peer_certBooleanServer will fail if the client does not have a certificate to send.
websocket.enableBooleanEnable websocket listener(default: true).
websocket.urlStringURL of websocket listener.
websocket.tls_urlStringURL of TLS over websocket listerner.
http_server.enableBooleanEnable http server listerner (default: false).
http_server.portIntegerPort of http server.
http_server.usernameStringUser name of http server.
http_server.passwordStringPassword of http server.
http_server.auth_typeEnumHttp server authentication type (default: basic).
http_server.jwt.public.keyfileStringpublic key file for JWT.
http_server.jwt.private.keyfileStringprivate key file for JWT.

# nanomq_bridge.conf

NameTypeDescription
bridge.bridge_modeBooleanEnter MQTT bridge mode (default false ).
bridge.addressStringRemote Broker address.
bridge.proto_verStringMQTT client version(3|4|5).
bridge.clientidStringMQTT client identifier.
bridge.keepaliveIntegerInterval of keepalive.
bridge.clean_startBooleanClean seeson.
bridge.parallelLongParallel of mqtt client.
bridge.usernameStringLogin user name.
bridge.passwordStringLogin password.
bridge.forwardsArray[String]Array of forward topics.( Use commas , to separate multiple topics )
bridge.mqtt.subscription.1.topicStringFirst Topic.
bridge.mqtt.subscription.1.qosIntegerFirst Qos.
bridge.mqtt.subscription.2.topicStringSecondTopic ( And so on ).
bridge.mqtt.subscription.2.qosIntegerSecondQos( And so on ).

# nanomq_auth_username.conf

NameTypeDescription
auth.1.loginStringFirst Username.
auth.1.passwordStringFirst Password.
auth.2.loginStringSecond Username ( And so on ).
auth.2.passwordStringSecond Password ( And so on ).

# nanomq_web_hook.conf

NameTypeDescription
web.hook.enableBooleanEnable WebHook (default: false)
web.hook.urlStringWebhook URL
web.hook.headers.<Any>StringHTTP Headers
Example:
1. web.hook.headers.content-type=application/json
2. web.hook.headers.accept=*
web.hook.body.encoding_of_payload_fieldEnumThe encoding format of the payload field in the HTTP body
Options:
plain | base64 | base62
web.hook.ssl.cacertfileStringPEM format file of CA's.
web.hook.ssl.certfileStringCertificate file to use, PEM format assumed.
web.hook.ssl.keyfileStringPrivate key file to use, PEM format assumed.
web.hook.ssl.verifyBooleanTurn on peer certificate verification (default: false).
web.hook.ssl.server_name_indicationBooleanVerify server_name (default: false).
web.hook.pool_sizeIntegerConnection process pool size (default: 32).
web.hook.rule.client.connack.<No>StringExample:
web.hook.rule.client.connack.1={"action": "on_client_connack"}
web.hook.rule.client.disconnected.<No>StringExample:
web.hook.rule.client.disconnected.1={"action": "on_client_disconnected"}
web.hook.rule.message.publish.<No>StringExample:
web.hook.rule.message.publish.1={"action": "on_message_publish"}
web.hook.rule.message.publish.1={"action": "on_message_publish", "topic": "topic/1/2"}
web.hook.rule.message.publish.2 = {"action": "on_message_publish", "topic": "foo/#"}

# nanomq_gateway.conf

NameTypeDescription
gateway.addressStringRemote Broker address.
gateway.proto_verStringMQTT client version(3|4|5).
gateway.clientidStringMQTT client identifier.
gateway.keepaliveIntegerInterval of keepalive.
gateway.clean_startBooleanClean seeson.
gateway.parallelLongParallel of mqtt client.
gateway.usernameStringLogin user name.
gateway.passwordStringLogin password.
gateway.forwardStringForward topic.
gateway.mqtt.subscription.topicStringMqtt subscribe topic.
gateway.mqtt.subscription.qosIntegerMqtt subscribe qos.
gateway.zmq.sub.addressStringRemote ZMQ server subscribe address.
gateway.zmq.pub.addressStringRemote ZMQ server publish address.
gateway.zmq.sub_prefixStringRemote ZMQ server subscribe prefix.
gateway.zmq.pub_prefixStringRemote ZMQ server publish prefix.