Skip to content

Commit

Permalink
Merge pull request #36 from nwithan8/fix_config
Browse files Browse the repository at this point in the history
Fix config parsing of non-existent config file (i.e. Docker environment)
  • Loading branch information
nwithan8 authored Aug 31, 2022
2 parents 8a7494d + 1015f11 commit fd95aaa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,10 @@ class Config:
def __init__(self, app_name: str, config_path: str, fallback_to_env: bool = True):
self.config = confuse.Configuration(app_name)
self.pull_from_env = False
# noinspection PyBroadException
try:
self.config.set_file(filename=config_path)
except FileNotFoundError:
except Exception: # pylint: disable=broad-except # not sure what confuse will throw
if not fallback_to_env:
raise FileNotFoundError(f"Config file not found: {config_path}")
self.pull_from_env = True
Expand Down

0 comments on commit fd95aaa

Please sign in to comment.