From 63a4316f271a15cc9e9718fbef6f54f2eb05ad20 Mon Sep 17 00:00:00 2001 From: Thomas Duval Date: Sun, 29 Oct 2017 21:12:28 +0100 Subject: Update the moonforming template Change-Id: I283a414acb2d38ca094bc542dec577b085217cf9 --- moonv4/templates/moonforming/utils/config.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 moonv4/templates/moonforming/utils/config.py (limited to 'moonv4/templates/moonforming/utils/config.py') diff --git a/moonv4/templates/moonforming/utils/config.py b/moonv4/templates/moonforming/utils/config.py new file mode 100644 index 00000000..30c8ea4f --- /dev/null +++ b/moonv4/templates/moonforming/utils/config.py @@ -0,0 +1,22 @@ +import yaml + + +def get_config_data(filename="moon.conf"): + data_config = None + for _file in ( + filename, + "conf/moon.conf", + "../moon.conf", + "../conf/moon.conf", + "/etc/moon/moon.conf", + ): + try: + data_config = yaml.safe_load(open(_file)) + except FileNotFoundError: + data_config = None + continue + else: + break + if not data_config: + raise Exception("Configuration file not found...") + return data_config -- cgit 1.2.3-korg