Environment variables for config

loraserver.toml is a pretty neat and easy config. Is there a way i can override the toml config so that specific values are injected as env variables directly onto the container since I am externalizing the data stores.

No, this is not possible.

On the 2.7.0 changelog for Lora Gateway Bridge, Lora Server, and Lora App server it has listed: " Environment variable based configuration has been re-implemented".

Does that mean that we can now use environment variables for configuration? I can’t find any documentation, but I would really like to be able to. Thanks.

It is documented, please see https://www.loraserver.io/lora-gateway-bridge/install/config/#environment-variables.


Apologies for being late to the thread, but thank you for continuing to support env variables. We are testing a deployment on Kubernetes, and the alternative configuration approaches are fairly onerous.

I’m trying to configure the lora-gateway-bridge using the following variables but it doesn’t seem to be referencing them.

bash/borne shell environment variables cannot contain a “dot” ‘.’ in it as the config documentation requires. Per shell convention, “dots” need to be replaced with ‘_’ (Underscores) and underscores with a double underscore

I get the following error:
ime=“2019-07-15T21:37:51Z” level=error msg=“could not setup mqtt backend, retry in 2 seconds: Network Error : dial tcp connect: connection refused”
time=“2019-07-15T21:37:53Z” level=info msg=“backend: TLS config is empty”
time=“2019-07-15T21:37:53Z” level=info msg=“backend: connecting to mqtt broker” server=“tcp://”

Ok after running a strings command on the lora-gateway-bridge binary i found an undocumented environment variable MQTT_SERVER :). I set it to my MQTT server and it worked. So is the configuration documentation wrong?

Hey @Haim_L,

How did you find the undocumented variables? I want to configure a subset of my app-server configuration using env_variables.

Thanks for your time!

Hey @brocaar,

Where can we find a full set of the enviromental variables? dot notation doesn’t work indeed.

You shouldn’t need any of the deprecated (“undocumented”) variables, almost every non-array variable matches up to its TOML grouping.

Which ones are you missing? The loraserver-docker repo has a good example for getting started with ENV-only configuration:

1 Like

I struggled with this for awhile until I figured it out. Those variables only work with docker-compose. They do not work using straight docker because bash/sh doesn’t support env vars with a ‘.’ in them

Hey everyone,

I think @Haim_L is correct, because when I run this script:

LORANK_IP=$(ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null root@ -p22222 "nslookup lorank8.local" | grep "192" | awk '{print $3}')
export LORANK_IP
echo "LORANK IP is: ${LORANK_IP}"

export REDIS.URL




I get all sorts of errors:

odys-macbook:lora_appserver Odys$ ./init_lora-app-server.sh
./init_lora-app-server.sh: line 8: POSTGRESQL.DSN=postgres://loraserver_as:loraserver_as@ No such file or directory
./init_lora-app-server.sh: line 9: REDIS.URL=redis// No such file or directory
./init_lora-app-server.sh: line 10: export: `POSTGRESQL.DSN': not a valid identifier
./init_lora-app-server.sh: line 11: export: `REDIS.URL': not a valid identifier
./init_lora-app-server.sh: line 13: APPLICATION_SERVER.INTEGRATION.MQTT.SERVER=tcp:// No such file or directory
./init_lora-app-server.sh: line 14: export: `APPLICATION_SERVER.INTEGRATION.MQTT.SERVER': not a valid identifier
./init_lora-app-server.sh: line 16: APPLICATION_SERVER.API.PUBLIC_HOST= command not found
./init_lora-app-server.sh: line 17: export: `APPLICATION_SERVER.API.PUBLIC_HOST': not a valid identifier

Is there any way to make it work without having to monkey patch a python script which will run gather the env_variables that I need and then create the toml file before starting app-server?

It is very important, because I run a distributed architecture and I need it to work with different networks.

Thanks everyone for your time :slight_smile:

This is a wide spread problem among many docker projects. They have resolved the issue by replacing ‘.’ with ‘__’ (double underscore). Until the lora code is modified to support this convention, there is nothing to be done other than to use docker-compose.

What is the notation for an array in docker compose environment variables. e.g. if you want to set APPLICATION_SERVER__INTEGRATION__ENABLED to `amqp?

In toml it lokks like:


How does it look in a compose file?