From f40afbcb7a19fb67989695608631721bafa27f31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Reuh=20Fildadut?= Date: Thu, 9 Oct 2025 16:55:15 +0200 Subject: [PATCH] feat: don't error on missing config file --- main.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index c9ce42a..0987f6e 100644 --- a/main.py +++ b/main.py @@ -17,10 +17,13 @@ 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 = tomllib.load(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()}" c = config.get(category, {})