Skip to content

Commit

Permalink
feat: raise an exception when toml is not installed and a configurati…
Browse files Browse the repository at this point in the history
…on file is passed in the environment
  • Loading branch information
azmeuk committed Dec 14, 2023
1 parent 2a799c6 commit 02a7e84
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion canaille/app/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def setup_config(app, config=None, validate_config=True):
)
if config:
app.config.from_mapping(parse_file_keys(config))
elif toml and "CONFIG" in os.environ:
elif "CONFIG" in os.environ:
if not toml: # pragma: no cover
raise Exception("toml library not installed. Cannot load configuration.")
app.config.from_mapping(parse_file_keys(toml.load(os.environ.get("CONFIG"))))
else:
raise Exception(
Expand Down

0 comments on commit 02a7e84

Please sign in to comment.