diff options
| author | Scott Gasch <[email protected]> | 2022-02-04 12:13:37 -0800 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2022-02-04 12:13:37 -0800 |
| commit | 4d03debb5b84b5b3e096add468ecd87c55ed0f5f (patch) | |
| tree | f74a251a3528bbbf8ea366164c0b6cda965d67bc /site_config.py | |
| parent | 65e6f781dffb268be6ef0a015f4cc89b57b62a5e (diff) | |
Have bootstrap log the site_config at program initialization.
Diffstat (limited to 'site_config.py')
| -rw-r--r-- | site_config.py | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/site_config.py b/site_config.py index 3bf049e..d98c6bc 100644 --- a/site_config.py +++ b/site_config.py @@ -92,16 +92,7 @@ def this_location() -> str: return location -def get_config(location_override: Optional[str] = None): - """ - Get a configuration dataclass with information that is - site-specific including the current running location. - - >>> cfg = get_config() - >>> cfg.location_name == 'HOUSE' or cfg.location_name == 'CABIN' - True - - """ +def effective_location(location_override: Optional[str] = None) -> str: if location_override is None: try: location_override = config.config['site_config_override_location'] @@ -111,8 +102,22 @@ def get_config(location_override: Optional[str] = None): if location_override is None or location_override == 'NONE': location = this_location() else: + logger.debug(f'site_config\'s location_override was set to: {location_override}') location = location_override + return location + +def get_config(location_override: Optional[str] = None): + """ + Get a configuration dataclass with information that is + site-specific including the current running location. + + >>> cfg = get_config() + >>> cfg.location_name == 'HOUSE' or cfg.location_name == 'CABIN' + True + + """ + location = effective_location(location_override) if location == 'HOUSE': return SiteConfig( location_name='HOUSE', |
