Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix config parsing of non-existent config file (i.e. Docker environment) #36

Merged
merged 1 commit into from
Aug 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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