Fix app config generation (#2245)

This commit is contained in:
Gilbert 2019-02-21 13:41:14 +08:00 committed by Gilbert Wong
parent 1626cade28
commit 796fc3b1ba
3 changed files with 145 additions and 134 deletions

View File

@ -1596,34 +1596,12 @@ listener.wss.external.ciphers = ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-G
##-------------------------------------------------------------------- ##--------------------------------------------------------------------
## Bridges to aws ## Bridges to aws
##-------------------------------------------------------------------- ##--------------------------------------------------------------------
## Start type of the bridge.
##
## Value: enum
## manual
## auto
## bridge.aws.start_type = manual
## Bridge reconnect time.
##
## Value: Duration
## Default: 30 seconds
## bridge.aws.reconnect_interval = 30s
## Retry interval for bridge QoS1 message delivering.
##
## Value: Duration
## bridge.aws.retry_interval = 20s
## Inflight size.
##
## Value: Integer
## bridge.aws.max_inflight = 32
## Bridge address: node name for local bridge, host:port for remote. ## Bridge address: node name for local bridge, host:port for remote.
## ##
## Value: String ## Value: String
## Example: emqx@127.0.0.1, 127.0.0.1:1883 ## Example: emqx@127.0.0.1, 127.0.0.1:1883
## bridge.aws.address = 127.0.0.1:1883 bridge.aws.address = 127.0.0.1:1883
## Protocol version of the bridge. ## Protocol version of the bridge.
## ##
@ -1631,12 +1609,12 @@ listener.wss.external.ciphers = ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-G
## - mqttv5 ## - mqttv5
## - mqttv4 ## - mqttv4
## - mqttv3 ## - mqttv3
## bridge.aws.proto_ver = mqttv4 bridge.aws.proto_ver = mqttv4
## The ClientId of a remote bridge. ## The ClientId of a remote bridge.
## ##
## Value: String ## Value: String
## bridge.aws.client_id = bridge_aws bridge.aws.client_id = bridge_aws
## The Clean start flag of a remote bridge. ## The Clean start flag of a remote bridge.
## ##
@ -1645,54 +1623,107 @@ listener.wss.external.ciphers = ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-G
## ##
## NOTE: Some IoT platforms require clean_start ## NOTE: Some IoT platforms require clean_start
## must be set to 'true' ## must be set to 'true'
## bridge.aws.clean_start = true bridge.aws.clean_start = true
## The username for a remote bridge. ## The username for a remote bridge.
## ##
## Value: String ## Value: String
## bridge.aws.username = user bridge.aws.username = user
## The password for a remote bridge. ## The password for a remote bridge.
## ##
## Value: String ## Value: String
## bridge.aws.password = passwd bridge.aws.password = passwd
## Mountpoint of the bridge. ## Mountpoint of the bridge.
## ##
## Value: String ## Value: String
## bridge.aws.mountpoint = bridge/aws/${node}/ bridge.aws.mountpoint = bridge/aws/${node}/
## Ping interval of a down bridge.
##
## Value: Duration
## Default: 10 seconds
## bridge.aws.keepalive = 60s
## Forward message topics ## Forward message topics
## ##
## Value: String ## Value: String
## Example: topic1/#,topic2/# ## Example: topic1/#,topic2/#
## bridge.aws.forwards = topic1/#,topic2/# bridge.aws.forwards = topic1/#,topic2/#
## Bribge to remote server via SSL.
##
## Value: on | off
bridge.aws.ssl = off
## PEM-encoded CA certificates of the bridge.
##
## Value: File
bridge.aws.cacertfile = {{ platform_etc_dir }}/certs/cacert.pem
## Client SSL Certfile of the bridge.
##
## Value: File
bridge.aws.certfile = {{ platform_etc_dir }}/certs/client-cert.pem
## Client SSL Keyfile of the bridge.
##
## Value: File
bridge.aws.keyfile = {{ platform_etc_dir }}/certs/client-key.pem
## SSL Ciphers used by the bridge.
##
## Value: String
bridge.aws.ciphers = ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384
## Ping interval of a down bridge.
##
## Value: Duration
## Default: 10 seconds
bridge.aws.keepalive = 60s
## TLS versions used by the bridge.
##
## Value: String
bridge.aws.tls_versions = tlsv1.2,tlsv1.1,tlsv1
## Subscriptions of the bridge topic. ## Subscriptions of the bridge topic.
## ##
## Value: String ## Value: String
## bridge.aws.subscription.1.topic = cmd/topic1 bridge.aws.subscription.1.topic = cmd/topic1
## Subscriptions of the bridge qos. ## Subscriptions of the bridge qos.
## ##
## Value: Number ## Value: Number
## bridge.aws.subscription.1.qos = 1 bridge.aws.subscription.1.qos = 1
## Subscriptions of the bridge topic. ## Subscriptions of the bridge topic.
## ##
## Value: String ## Value: String
## bridge.aws.subscription.2.topic = cmd/topic2 bridge.aws.subscription.2.topic = cmd/topic2
## Subscriptions of the bridge qos. ## Subscriptions of the bridge qos.
## ##
## Value: Number ## Value: Number
## bridge.aws.subscription.2.qos = 1 bridge.aws.subscription.2.qos = 1
## Start type of the bridge.
##
## Value: enum
## manual
## auto
bridge.aws.start_type = manual
## Bridge reconnect time.
##
## Value: Duration
## Default: 30 seconds
bridge.aws.reconnect_interval = 30s
## Retry interval for bridge QoS1 message delivering.
##
## Value: Duration
bridge.aws.retry_interval = 20s
## Inflight size.
##
## Value: Integer
bridge.aws.max_inflight = 32
## Maximum number of messages in one batch when sending to remote borkers ## Maximum number of messages in one batch when sending to remote borkers
## NOTE: when bridging via MQTT connection to remote broker, this config is only ## NOTE: when bridging via MQTT connection to remote broker, this config is only
@ -1701,76 +1732,23 @@ listener.wss.external.ciphers = ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-G
## ##
## Value: Integer ## Value: Integer
## default: 32 ## default: 32
## bridge.aws.queue.batch_size = 32 bridge.aws.queue.batch_size = 32
## Base directory for replayq to store messages on disk ## Base directory for replayq to store messages on disk
## If this config entry is missing or set to undefined, ## If this config entry is missing or set to undefined,
## replayq works in a mem-only manner. ## replayq works in a mem-only manner.
## ##
## Value: String ## Value: String
## bridge.aws.queue.replayq_dir = {{ platform_data_dir }}/emqx_aws_bridge/ bridge.aws.queue.replayq_dir = {{ platform_data_dir }}/emqx_aws_bridge/
## Replayq segment size ## Replayq segment size
## ##
## Value: Bytesize ## Value: Bytesize
bridge.aws.queue.replayq_seg_bytes = 10MB
## bridge.aws.queue.replayq_seg_bytes = 10MB
## Bribge to remote server via SSL.
##
## Value: on | off
## bridge.aws.ssl = off
## PEM-encoded CA certificates of the bridge.
##
## Value: File
## bridge.aws.cacertfile = {{ platform_etc_dir }}/certs/cacert.pem
## Client SSL Certfile of the bridge.
##
## Value: File
## bridge.aws.certfile = {{ platform_etc_dir }}/certs/client-cert.pem
## Client SSL Keyfile of the bridge.
##
## Value: File
## bridge.aws.keyfile = {{ platform_etc_dir }}/certs/client-key.pem
## SSL Ciphers used by the bridge.
##
## Value: String
## bridge.aws.ciphers = ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384
## TLS versions used by the bridge.
##
## Value: String
## bridge.aws.tls_versions = tlsv1.2,tlsv1.1,tlsv1
##-------------------------------------------------------------------- ##--------------------------------------------------------------------
## Bridges to azure ## Bridges to azure
##-------------------------------------------------------------------- ##--------------------------------------------------------------------
## Start type of the bridge.
##
## Value: enum
## manual
## auto
## bridge.azure.start_type = manual
## Bridge reconnect count.
##
## Value: Number
## bridge.azure.reconnect_count = 10
## Bridge reconnect time.
##
## Value: Duration
## Default: 30 seconds
## bridge.azure.reconnect_time = 30s
## Retry interval for bridge QoS1 message delivering.
##
## Value: Duration
## bridge.azure.retry_interval = 20s
## Bridge address: node name for local bridge, host:port for remote. ## Bridge address: node name for local bridge, host:port for remote.
## ##
@ -1789,7 +1767,7 @@ listener.wss.external.ciphers = ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-G
## The ClientId of a remote bridge. ## The ClientId of a remote bridge.
## ##
## Value: String ## Value: String
## bridge.azure.client_id = bridge_azure ## bridge.azure.client_id = bridge_aws
## The Clean start flag of a remote bridge. ## The Clean start flag of a remote bridge.
## ##
@ -1813,13 +1791,7 @@ listener.wss.external.ciphers = ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-G
## Mountpoint of the bridge. ## Mountpoint of the bridge.
## ##
## Value: String ## Value: String
## bridge.azure.mountpoint = bridge/azure/${node}/ ## bridge.azure.mountpoint = bridge/aws/${node}/
## Ping interval of a down bridge.
##
## Value: Duration
## Default: 10 seconds
## bridge.azure.keepalive = 10s
## Forward message topics ## Forward message topics
## ##
@ -1827,10 +1799,46 @@ listener.wss.external.ciphers = ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-G
## Example: topic1/#,topic2/# ## Example: topic1/#,topic2/#
## bridge.azure.forwards = topic1/#,topic2/# ## bridge.azure.forwards = topic1/#,topic2/#
## Bribge to remote server via SSL.
##
## Value: on | off
## bridge.azure.ssl = off
## PEM-encoded CA certificates of the bridge.
##
## Value: File
## bridge.azure.cacertfile = {{ platform_etc_dir }}/certs/cacert.pem
## Client SSL Certfile of the bridge.
##
## Value: File
## bridge.azure.certfile = {{ platform_etc_dir }}/certs/client-cert.pem
## Client SSL Keyfile of the bridge.
##
## Value: File
## bridge.azure.keyfile = {{ platform_etc_dir }}/certs/client-key.pem
## SSL Ciphers used by the bridge.
##
## Value: String
## bridge.azure.ciphers = ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384
## Ping interval of a down bridge.
##
## Value: Duration
## Default: 10 seconds
## bridge.azure.keepalive = 60s
## TLS versions used by the bridge.
##
## Value: String
## bridge.azure.tls_versions = tlsv1.2,tlsv1.1,tlsv1
## Subscriptions of the bridge topic. ## Subscriptions of the bridge topic.
## ##
## Value: String ## Value: String
## bridge.azure.subscription.1.topic = $share/cmd/topic1 ## bridge.azure.subscription.1.topic = cmd/topic1
## Subscriptions of the bridge qos. ## Subscriptions of the bridge qos.
## ##
@ -1840,13 +1848,36 @@ listener.wss.external.ciphers = ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-G
## Subscriptions of the bridge topic. ## Subscriptions of the bridge topic.
## ##
## Value: String ## Value: String
## bridge.azure.subscription.2.topic = $share/cmd/topic2 ## bridge.azure.subscription.2.topic = cmd/topic2
## Subscriptions of the bridge qos. ## Subscriptions of the bridge qos.
## ##
## Value: Number ## Value: Number
## bridge.azure.subscription.2.qos = 1 ## bridge.azure.subscription.2.qos = 1
## Start type of the bridge.
##
## Value: enum
## manual
## auto
## bridge.azure.start_type = manual
## Bridge reconnect time.
##
## Value: Duration
## Default: 30 seconds
## bridge.azure.reconnect_interval = 30s
## Retry interval for bridge QoS1 message delivering.
##
## Value: Duration
## bridge.azure.retry_interval = 20s
## Inflight size.
##
## Value: Integer
## bridge.azure.max_inflight = 32
## Maximum number of messages in one batch when sending to remote borkers ## Maximum number of messages in one batch when sending to remote borkers
## NOTE: when bridging via MQTT connection to remote broker, this config is only ## NOTE: when bridging via MQTT connection to remote broker, this config is only
## used for internal message passing optimization as the underlying MQTT ## used for internal message passing optimization as the underlying MQTT
@ -1861,38 +1892,13 @@ listener.wss.external.ciphers = ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-G
## replayq works in a mem-only manner. ## replayq works in a mem-only manner.
## ##
## Value: String ## Value: String
## Default: "" ## bridge.azure.queue.replayq_dir = {{ platform_data_dir }}/emqx_aws_bridge/
## bridge.azure.queue.replayq_dir = {{ platform_data_dir }}/emqx_azure.bridge/
## Replayq segment size ## Replayq segment size
## ##
## Value: Bytesize ## Value: Bytesize
## bridge.azure.queue.replayq_seg_bytes = 10MB ## bridge.azure.queue.replayq_seg_bytes = 10MB
## PEM-encoded CA certificates of the bridge.
##
## Value: File
## bridge.azure.cacertfile = cacert.pem
## Client SSL Certfile of the bridge.
##
## Value: File
## bridge.azure.certfile = cert.pem
## Client SSL Keyfile of the bridge.
##
## Value: File
## bridge.azure.keyfile = key.pem
## SSL Ciphers used by the bridge.
##
## Value: String
## bridge.azure.ciphers = ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384
## TLS versions used by the bridge.
##
## Value: String
## bridge.azure.tls_versions = tlsv1.2,tlsv1.1,tlsv1
##-------------------------------------------------------------------- ##--------------------------------------------------------------------
## Modules ## Modules

View File

@ -1595,6 +1595,11 @@ end}.
{datatype, {duration, ms}} {datatype, {duration, ms}}
]}. ]}.
{mapping, "bridge.$name.retry_interval", "emqx.bridges", [
{default, "20s"},
{datatype, {duration, ms}}
]}.
{mapping, "bridge.$name.max_inflight", "emqx.bridges", [ {mapping, "bridge.$name.max_inflight", "emqx.bridges", [
{default, 0}, {default, 0},
{datatype, integer} {datatype, integer}
@ -1659,7 +1664,8 @@ end}.
end end
end, end,
ConnMod = fun(Name) -> ConnMod = fun(Name) ->
[Addr] = cuttlefish_variable:filter_by_prefix("bridge." ++ Name ++ ".address", Conf), [AddrConfig] = cuttlefish_variable:filter_by_prefix("bridge." ++ Name ++ ".address", Conf),
{_, Addr} = AddrConfig,
Subs = Subscriptions(Name), Subs = Subscriptions(Name),
case IsNodeAddr(Addr) of case IsNodeAddr(Addr) of
true when Subs =/= [] -> true when Subs =/= [] ->

View File

@ -190,4 +190,3 @@ do_receive_and_match_messages(Ref, [I | Rest]) ->
end, end,
do_receive_and_match_messages(Ref, Rest) do_receive_and_match_messages(Ref, Rest)
end. end.