mirror of
https://codeberg.org/Reuh/feather.git
synced 2025-10-27 18:19:32 +00:00
feat: don't error on missing config file
This commit is contained in:
parent
06dc961d62
commit
f40afbcb7a
1 changed files with 7 additions and 4 deletions
7
main.py
7
main.py
|
|
@ -17,9 +17,12 @@ class Config:
|
|||
with open("config.default.toml", "rb") as f:
|
||||
default_config = tomllib.load(f)
|
||||
|
||||
config_path = os.environ.get("CONFIG_PATH") or "config.toml"
|
||||
with open(config_path, "rb") as f:
|
||||
config_path = Path(os.environ.get("CONFIG_PATH") or "config.toml")
|
||||
if config_path.exists():
|
||||
with config_path.open("rb") as f:
|
||||
config = tomllib.load(f)
|
||||
else:
|
||||
config = {}
|
||||
|
||||
def get_config(category, field, can_default=True):
|
||||
env_name = f"{category.upper()}_{field.upper()}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue