Write the all-in-one.conf taking into account *all* the CW environment variable
Currently only a few environment variables are taken into account to write the final all-in-one.conf
.
It would be nice to handle all the variables.
We could for instance, when writting/updating the all-in-one.conf, loop over all the variables starting with CW_
and update the corresponding key/values in the config file.
I guess it could be something like this:
all_in_one_conf_path = Path(to_config)
all_in_one_content = all_in_one_conf_path.read_text()
for key, value in os.environ.items():
if not key.startswith("CW"):
continue
key_in_all_in_one = '-'.join(key[len("CW_"):].split('_')).lower()
all_in_one_content = re.sub(f"{key_in_all_in_one}=.*", f"{key_in_all_in_one}={value}", all_in_one_content)
all_in_one_conf_path.write_text(all_in_one_content)