From 5f2066aad4c6d427448894bd314340b1e0da13a4 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Fri, 8 Mar 2019 00:16:00 +0100 Subject: [PATCH] config: use /etc/asu/config.yml if exists --- asu/utils/config.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/asu/utils/config.py b/asu/utils/config.py index d3add469..4bc44f58 100644 --- a/asu/utils/config.py +++ b/asu/utils/config.py @@ -9,12 +9,14 @@ class Config: def __init__(self): self.config = {} - self.config_file = "config.yml" self.root_dir = os.path.dirname(os.path.abspath(__file__)) + self.config_file = "/etc/asu/config.yml" if not os.path.exists(self.config_file): - with open(self.root_dir + "/config.yml.default", "r") as default_file: - with open("config.yml", "w") as config_file: - config_file.write(default_file.read()) + self.config_file = "config.yml" + if not os.path.exists(self.config_file): + with open(self.root_dir + "/config.yml.default", "r") as default_file: + with open("config.yml", "w") as config_file: + config_file.write(default_file.read()) with open(self.config_file, "r") as ymlfile: self.config = yaml.load(ymlfile)