Skip to content

Commit

Permalink
config: use /etc/asu/config.yml if exists
Browse files Browse the repository at this point in the history
  • Loading branch information
aparcar committed Mar 7, 2019
1 parent a99addd commit 5f2066a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions asu/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5f2066a

Please sign in to comment.