@@ -15,104 +15,96 @@ const configTemplate = `[general]
1515log_level = {{ .General.LogLevel }}
1616
1717
18- # Configuration which relates to the packet-forwarder.
19- [packet_forwarder]
20- # ip:port to bind the UDP listener to
21- #
22- # Example: 0.0.0.0:1700 to listen on port 1700 for all network interfaces.
23- # This is the listeren to which the packet-forwarder forwards its data
24- # so make sure the 'serv_port_up' and 'serv_port_down' from your
25- # packet-forwarder matches this port.
26- udp_bind = "{{ .PacketForwarder.UDPBind }}"
18+ # Gateway backend configuration.
19+ [backend]
2720
28- # Skip the CRC status-check of received packets
29- #
30- # This is only has effect when the packet-forwarder is configured to forward
31- # LoRa frames with CRC errors.
32- skip_crc_check = {{ .PacketForwarder.SkipCRCCheck }}
33-
34-
35- # # Managed packet-forwarder configuration.
36- # #
37- # # By configuring one or multiple managed packet-forwarder sections, the
38- # # LoRa Gateway Bridge updates the configuration when the backend receives
39- # # a configuration change, after which it will restart the packet-forwarder.
40- # [[packet_forwarder.configuration]]
41- # # Gateway MAC.
42- # #
43- # # The LoRa Gateway Bridge will only apply the configuration updates for this
44- # # gateway MAC.
45- # mac="0102030405060708"
46-
47- # # Base configuration file.
48- # #
49- # # This file will be used as base-configuration and will not be overwritten on
50- # # a configuration update. This file needs to exist and contains the base
51- # # configuration and vendor specific
52- # base_file="/etc/lora-packet-forwarder/global_conf.json"
53-
54- # # Output configuration file.
55- # #
56- # # This will be the final configuration for the packet-forwarder, containing
57- # # a merged version of the base configuration + the requested configuration
58- # # update.
59- # # Warning: this file will be overwritten on a configuration update!
60- # output_file="/etc/lora-packet-forwarder/local_conf.json"
61-
62- # # Restart command.
63- # #
64- # # This command is issued by the LoRa Gateway Bridge on a configuration
65- # # change. Make sure the LoRa Gateway Bridge process has sufficient
66- # # permissions to execute this command.
67- # restart_command="/etc/init.d/lora-packet-forwarder restart"
68-
69-
70- # Configuration for the MQTT backend.
71- [backend.mqtt]
72- # MQTT topic templates for the different MQTT topics.
73- #
74- # The meaning of these topics are documented at:
75- # https://docs.loraserver.io/lora-gateway-bridge/use/data/
76- #
77- # The default values match the default expected configuration of the
78- # LoRa Server MQTT backend. Therefore only change these values when
79- # absolutely needed.
80- # Use "{{ "{{ .MAC }}" }}" as an substitution for the LoRa gateway MAC.
81- #
82- # Note that some authentication types might overwrite these templates (e.g.
83- # in case of GCP Cloud IoT Core)!
84- uplink_topic_template="{{ .Backend.MQTT.UplinkTopicTemplate }}"
85- downlink_topic_template="{{ .Backend.MQTT.DownlinkTopicTemplate }}"
86- stats_topic_template="{{ .Backend.MQTT.StatsTopicTemplate }}"
87- ack_topic_template="{{ .Backend.MQTT.AckTopicTemplate }}"
88- config_topic_template="{{ .Backend.MQTT.ConfigTopicTemplate }}"
21+ # Semtech UDP packet-forwarder backend.
22+ [backend.semtech_udp]
8923
24+ # ip:port to bind the UDP listener to
25+ #
26+ # Example: 0.0.0.0:1700 to listen on port 1700 for all network interfaces.
27+ # This is the listeren to which the packet-forwarder forwards its data
28+ # so make sure the 'serv_port_up' and 'serv_port_down' from your
29+ # packet-forwarder matches this port.
30+ udp_bind = "{{ .Backend.SemtechUDP.UDPBind }}"
31+
32+ # Skip the CRC status-check of received packets
33+ #
34+ # This is only has effect when the packet-forwarder is configured to forward
35+ # LoRa frames with CRC errors.
36+ skip_crc_check = {{ .Backend.SemtechUDP.SkipCRCCheck }}
37+
38+ # # Managed packet-forwarder configuration.
39+ # #
40+ # # By configuring one or multiple managed packet-forwarder sections, the
41+ # # LoRa Gateway Bridge updates the configuration when the backend receives
42+ # # a configuration change, after which it will restart the packet-forwarder.
43+ # [[packet_forwarder.configuration]]
44+ # # Gateway ID.
45+ # #
46+ # # The LoRa Gateway Bridge will only apply the configuration updates for this
47+ # # gateway ID.
48+ # gateway_id="0102030405060708"
49+
50+ # # Base configuration file.
51+ # #
52+ # # This file will be used as base-configuration and will not be overwritten on
53+ # # a configuration update. This file needs to exist and contains the base
54+ # # configuration and vendor specific
55+ # base_file="/etc/lora-packet-forwarder/global_conf.json"
56+
57+ # # Output configuration file.
58+ # #
59+ # # This will be the final configuration for the packet-forwarder, containing
60+ # # a merged version of the base configuration + the requested configuration
61+ # # update.
62+ # # Warning: this file will be overwritten on a configuration update!
63+ # output_file="/etc/lora-packet-forwarder/local_conf.json"
64+
65+ # # Restart command.
66+ # #
67+ # # This command is issued by the LoRa Gateway Bridge on a configuration
68+ # # change. Make sure the LoRa Gateway Bridge process has sufficient
69+ # # permissions to execute this command.
70+ # restart_command="/etc/init.d/lora-packet-forwarder restart"
71+
72+
73+ # Integration configuration.
74+ [integration]
9075# Payload marshaler.
9176#
9277# This defines how the MQTT payloads are encoded. Valid options are:
9378# * protobuf: Protobuf encoding (this will become the LoRa Gateway Bridge v3 default)
9479# * json: JSON encoding (easier for debugging, but less compact than 'protobuf')
95- marshaler="{{ .Backend.MQTT.Marshaler }}"
80+ marshaler="{{ .Integration.Marshaler }}"
81+
82+ # MQTT integration configuration.
83+ [integration.mqtt]
84+ # Event topic template.
85+ event_topic_template="{{ .Integration.MQTT.EventTopicTemplate }}"
86+
87+ # Command topic template.
88+ command_topic_template="{{ .Integration.MQTT.CommandTopicTemplate }}"
89+
9690
9791 # MQTT authentication.
98- [backend .mqtt.auth]
92+ [integration .mqtt.auth]
9993 # Type defines the MQTT authentication type to use.
10094 #
10195 # Set this to the name of one of the sections below.
102- # Note: when the 'v2_json marhaler' is configured, the generic backend will
103- # always be used.
104- type="{{ .Backend.MQTT.Auth.Type }}"
96+ type="{{ .Integration.MQTT.Auth.Type }}"
10597
10698 # Generic MQTT authentication.
107- [backend .mqtt.auth.generic]
99+ [integration .mqtt.auth.generic]
108100 # MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
109- server="{{ .Backend .MQTT.Auth.Generic.Server }}"
101+ server="{{ .Integration .MQTT.Auth.Generic.Server }}"
110102
111103 # Connect with the given username (optional)
112- username="{{ .Backend .MQTT.Auth.Generic.Username }}"
104+ username="{{ .Integration .MQTT.Auth.Generic.Username }}"
113105
114106 # Connect with the given password (optional)
115- password="{{ .Backend .MQTT.Auth.Generic.Password }}"
107+ password="{{ .Integration .MQTT.Auth.Generic.Password }}"
116108
117109 # Quality of service level
118110 #
@@ -122,63 +114,63 @@ marshaler="{{ .Backend.MQTT.Marshaler }}"
122114 #
123115 # Note: an increase of this value will decrease the performance.
124116 # For more information: https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels
125- qos={{ .Backend .MQTT.Auth.Generic.QOS }}
117+ qos={{ .Integration .MQTT.Auth.Generic.QOS }}
126118
127119 # Clean session
128120 #
129121 # Set the "clean session" flag in the connect message when this client
130122 # connects to an MQTT broker. By setting this flag you are indicating
131123 # that no messages saved by the broker for this client should be delivered.
132- clean_session={{ .Backend .MQTT.Auth.Generic.CleanSession }}
124+ clean_session={{ .Integration .MQTT.Auth.Generic.CleanSession }}
133125
134126 # Client ID
135127 #
136128 # Set the client id to be used by this client when connecting to the MQTT
137129 # broker. A client id must be no longer than 23 characters. When left blank,
138130 # a random id will be generated. This requires clean_session=true.
139- client_id="{{ .Backend .MQTT.Auth.Generic.ClientID }}"
131+ client_id="{{ .Integration .MQTT.Auth.Generic.ClientID }}"
140132
141133 # CA certificate file (optional)
142134 #
143135 # Use this when setting up a secure connection (when server uses ssl://...)
144136 # but the certificate used by the server is not trusted by any CA certificate
145137 # on the server (e.g. when self generated).
146- ca_cert="{{ .Backend .MQTT.Auth.Generic.CACert }}"
138+ ca_cert="{{ .Integration .MQTT.Auth.Generic.CACert }}"
147139
148140 # mqtt TLS certificate file (optional)
149- tls_cert="{{ .Backend .MQTT.Auth.Generic.TLSCert }}"
141+ tls_cert="{{ .Integration .MQTT.Auth.Generic.TLSCert }}"
150142
151143 # mqtt TLS key file (optional)
152- tls_key="{{ .Backend .MQTT.Auth.Generic.TLSKey }}"
144+ tls_key="{{ .Integration .MQTT.Auth.Generic.TLSKey }}"
153145
154146 # Maximum interval that will be waited between reconnection attempts when connection is lost.
155147 # Valid units are 'ms', 's', 'm', 'h'. Note that these values can be combined, e.g. '24h30m15s'.
156- max_reconnect_interval="{{ .Backend .MQTT.Auth.Generic.MaxReconnectInterval }}"
148+ max_reconnect_interval="{{ .Integration .MQTT.Auth.Generic.MaxReconnectInterval }}"
157149
158150
159151 # Google Cloud Platform Cloud IoT Core authentication.
160152 #
161153 # Please note that when using this authentication type, the MQTT topics
162154 # will be automatically set to match the MQTT topics as expected by
163155 # Cloud IoT Core.
164- [backend .mqtt.auth.gcp_cloud_iot_core]
156+ [integration .mqtt.auth.gcp_cloud_iot_core]
165157 # MQTT server.
166- server="{{ .Backend .MQTT.Auth.GCPCloudIoTCore.Server }}"
158+ server="{{ .Integration .MQTT.Auth.GCPCloudIoTCore.Server }}"
167159
168160 # Google Cloud IoT Core Device id.
169- device_id="{{ .Backend .MQTT.Auth.GCPCloudIoTCore.DeviceID }}"
161+ device_id="{{ .Integration .MQTT.Auth.GCPCloudIoTCore.DeviceID }}"
170162
171163 # Google Cloud project id.
172- project_id="{{ .Backend .MQTT.Auth.GCPCloudIoTCore.ProjectID }}"
164+ project_id="{{ .Integration .MQTT.Auth.GCPCloudIoTCore.ProjectID }}"
173165
174166 # Google Cloud region.
175- cloud_region="{{ .Backend .MQTT.Auth.GCPCloudIoTCore.CloudRegion }}"
167+ cloud_region="{{ .Integration .MQTT.Auth.GCPCloudIoTCore.CloudRegion }}"
176168
177169 # Google Cloud IoT registry id.
178- registry_id="{{ .Backend .MQTT.Auth.GCPCloudIoTCore.RegistryID }}"
170+ registry_id="{{ .Integration .MQTT.Auth.GCPCloudIoTCore.RegistryID }}"
179171
180172 # JWT token expiration time.
181- jwt_expiration="{{ .Backend .MQTT.Auth.GCPCloudIoTCore.JWTExpiration }}"
173+ jwt_expiration="{{ .Integration .MQTT.Auth.GCPCloudIoTCore.JWTExpiration }}"
182174
183175 # JWT token key-file.
184176 #
@@ -188,7 +180,7 @@ marshaler="{{ .Backend.MQTT.Marshaler }}"
188180 #
189181 # Then point the setting below to the private-key.pem and associate the
190182 # public-key.pem with this device / gateway in Google Cloud IoT Core.
191- jwt_key_file="{{ .Backend .MQTT.Auth.GCPCloudIoTCore.JWTKeyFile }}"
183+ jwt_key_file="{{ .Integration .MQTT.Auth.GCPCloudIoTCore.JWTKeyFile }}"
192184
193185
194186# Metrics configuration.
0 commit comments