1
0
Fork 0
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:
Étienne Fildadut 2025-10-09 16:55:15 +02:00
parent 06dc961d62
commit f40afbcb7a

View file

@ -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()}"