Closed siggiskulason closed 2 years ago
root caused the issue to ListenForCustomConfigChanges in go-mod-bootstrap needs to ignore the first change notification same as regular config does here: https://github.com/edgexfoundry/go-mod-bootstrap/blob/main/bootstrap/config/config.go#L466-L472
The first change notification is bogus and causes issues with values that have been override with Env.
There is an issue with overriding the AppCustom settings with environment variables if an existing value is already in Consul.
Example:
configuration.toml
contains the settingWe then run the service (I have tested this both running natively and using the snap)
Run the above - that will generate the key/value pairs in Consul, using the values from the config file, including an empy DiscoverySubnets string
What then happens when we run is that as expected we get a message about "Empty CIDR provided, unable to scan for LLRP readers."
Now stop the device service, set the environment variable and start it again
The problem is that when it starts up, we get it starting up with the overriden value as expected:
but then,
updateWritableConfig(rawWritableConfig
indriver.go
gets called to update the value back to the setting in Consuland we have the values
so the value gets replaced by the setting in Consul and discovery fails, as it has an empty subnet value
What this issue means in practice, is that it's not possible to override the DiscoverySubnet value in Consul. Therefore the "snap set" method of setting these values will not work, as it works by setting environment overrides.