Toml array variable as environment variable notation

Hi,

I read about the double underscore replace the dot to avoid problems with environment variables. So how would one write the environment variables for the extra_channels setting in the network server toml ?

[[network_server.network_settings.extra_channels]]
frequency=867100000
min_dr=0
max_dr=5

to

NETWORK_SERVER__NETWORK_SETTINGS__EXTRA_CHANNELS__FREQUENCY=867100000
NETWORK_SERVER__NETWORK_SETTINGS__EXTRA_CHANNELS__MIN_DR=0
NETWORK_SERVER__NETWORK_SETTINGS__EXTRA_CHANNELS__MAX_DR=5

How do I add another frequency,min_dr,max_dr item as environment variable ?

I could not find any information about how the conversion would work with arrays in environment variables.


That one is a little tricky. We have the following in our Kubernetes YAML:

        {{- if .Values.global.chirpstack.extrachannels.enabled }}
        - name: NETWORK_SERVER__NETWORK_SETTINGS__EXTRA_CHANNELS
          value: {{ .Values.global.chirpstack.extrachannels.channels | toJson | quote }}
        {{- end }}

And the channels value itself is:

        [
          { "frequency": 867100000, "min_dr": 0, "max_dr": 5 },
          { "frequency": 867300000, "min_dr": 0, "max_dr": 5 },
          { "frequency": 867500000, "min_dr": 0, "max_dr": 5 },
          { "frequency": 867700000, "min_dr": 0, "max_dr": 5 },
          { "frequency": 867900000, "min_dr": 0, "max_dr": 5 },
        ]

So an extra layer of quoting may be required. The best place to understand it may be in the cmd/ directory of the network server repo.

1 Like

thank you, I’ll have a look.