CdC-SI / eak-copilot

The official repository of the EAK-Copilot project as part of the Innovation Fellowship 2024.
https://cdc-si.github.io/eak-copilot/
GNU General Public License v3.0
4 stars 0 forks source link

implement config value validation #181

Closed K-Schubert closed 1 month ago

K-Schubert commented 1 month ago

Description

Implement config value validations in config/base_config.py.

Create check_env_vars() in utils/check_env.py.

NOTE: should the docker-compose up quit with a sys.exit(1) when an env variable is not defined properly, or raise error (printed in terminal) and continue upping other services?

NOTE: in yaml, true/false, on/off, yes/no are equivalent. Should we enforce config.yaml "bool" values to only be set to true/false and not yes/not, on/off?

K-Schubert commented 1 month ago

@tabee what do you think about the NOTE?

tabee commented 1 month ago

@tabee what do you think about the NOTE?

K-Schubert commented 1 month ago

It is possible to enforce that only true/false values are entered in the yaml "boolean" fields. However yaml is used for it's flexibility to interpet "y|Y|yes|Yes|YES|n|N|no|No|NO |true|True|TRUE|false|False|FALSE |on|On|ON|off|Off|OFF" as True/False, so maybe if using yaml it's best to keep it this way?

K-Schubert commented 1 month ago

Also if a service exits with code 1 (sys.exit(1)) because of a misspecified config var from config.yaml, then only the services that "depend_on" this service in docker-compose.yml will also exit. Docker-compose by default will run all other services even if one fails. Also if one service fails, we can specify the "restart: always" key to re-up the service which can be helpful. But this restart behaviour can be problematic if a service fails due to a sys.exit(1).