This PR is probably ok to merge without much or any review, but it touches a lot of files and has some opinionated style changes which you might care about.
All config now read from either environment or .env files (environment overriding .env).
Secrets are now read from the same .env file as other settings. We can discuss and change this choice. Without discussion, easy alternatives had subtle complications without obvious big win on security or usability.
Renamed variables for case, scope and clarity since they are now part of an explicit object, not constants.
The next PR will investigate passing the settings object rather than importing it, so we have greater control over when the setting are read.
ActorBase, CloudBase and all desecendants now take a ScadaSettings object in their constructor. This is stored as a member variable and the settings are now accessed through the member variable, not through the imported module.
run_nodes_main() and scripts that use it now have and use a parameter for a .env file.
script functions use the .env file and environment to create a ScadaSettings object, which they pass along.
Tests now automatically clear relevant environment variables before very test. See test/conftest.py, clean_scada_env() for details.
load_house.load_all() now requires a passed in world_root_alias.
The logging_on parameter was moved into ScadaSettings.
Logging output directory taken from self.settings.
mqttBroker, mqttBrokerPort self.gwMqttBroker and gwMqttBrokerPort are no longer member variables but are now accessed through self.settings.
NodeConfig now takes a settings object.
The README is not yet updated. If the other changes look good to you (or we just decide to merge without review), I'll update README.
Setting read from environment and .env files with pydantic, and explicitly constructed and passed around, not automatically constructed on import.
TL, DR: Check out config.py and this and this.
This PR is probably ok to merge without much or any review, but it touches a lot of files and has some opinionated style changes which you might care about.
Changes include:
The README is not yet updated. If the other changes look good to you (or we just decide to merge without review), I'll update README.