Add the ability to manually configure server 0, which is normally used by TTN

This commit is contained in:
jpmeijers 2017-11-12 22:52:13 +02:00
parent 788cdf9d35
commit e40d71b4a8
2 changed files with 26 additions and 0 deletions

View File

@ -68,6 +68,16 @@ All server variables are optional, but when a server is enabled, it is recommend
* SERVER_3_GWKEY * SERVER_3_GWKEY
* SERVER_3_DOWNLINK - default false * SERVER_3_DOWNLINK - default false
As long as `SERVER_TTN` is set to false, you can also:
* SERVER_0_ENABLED optional - default false
* SERVER_0_TYPE - default "semtech"
* SERVER_0_ADDRESS
* SERVER_0_PORTUP - only when using type semtech
* SERVER_0_PORTDOWN - only when using type semtech
* SERVER_0_GWID
* SERVER_0_GWKEY
* SERVER_0_DOWNLINK - default false
## Example for using only legacy forwarder ## Example for using only legacy forwarder
| Variable | Value | | Variable | Value |

16
run.py
View File

@ -221,6 +221,22 @@ if(os.getenv('SERVER_TTN', "true")=="true"):
server['serv_gw_key'] = os.environ.get("GW_KEY") server['serv_gw_key'] = os.environ.get("GW_KEY")
server['serv_enabled'] = True server['serv_enabled'] = True
gateway_conf['servers'].append(server) gateway_conf['servers'].append(server)
else:
if(os.getenv('SERVER_0_ENABLED', "false")=="true"):
server = {}
if(os.getenv('SERVER_0_TYPE', "semtech")=="ttn"):
server['serv_type'] = "ttn"
server['serv_gw_id'] = os.environ.get("SERVER_0_GWID")
server['serv_gw_key'] = os.environ.get("SERVER_0_GWKEY")
server['server_address'] = os.environ.get("SERVER_0_ADDRESS")
server['serv_port_up'] = int(os.getenv("SERVER_0_PORTUP", 1700))
server['serv_port_down'] = int(os.getenv("SERVER_0_PORTDOWN", 1700))
server['serv_enabled'] = True
if(os.getenv('SERVER_0_DOWNLINK', "false")=="true"):
server['serv_down_enabled'] = True
else:
server['serv_down_enabled'] = False
gateway_conf['servers'].append(server)
# Add up to 3 additional servers # Add up to 3 additional servers
if(os.getenv('SERVER_1_ENABLED', "false")=="true"): if(os.getenv('SERVER_1_ENABLED', "false")=="true"):