diff --git a/gitea_hooks/conf.py b/gitea_hooks/conf.py index 630a6e5..1082705 100644 --- a/gitea_hooks/conf.py +++ b/gitea_hooks/conf.py @@ -1,4 +1,5 @@ import yaml +from pathlib import Path class BadConfig(Exception): @@ -11,9 +12,11 @@ class Configuration: The configuration is a YAML file. """ + BASE_CONFIG_PATH = Path.home() / "config.yml" + def __init__(self): try: - with open("./config.yml", "r") as handle: + with self.BASE_CONFIG_PATH.open("r") as handle: self.raw = yaml.safe_load(handle) except yaml.YAMLError as exn: raise BadConfig("Cannot parse yaml") from exn