diff options
author | Thomas Duval <thomas.duval@orange.com> | 2017-10-29 21:12:28 +0100 |
---|---|---|
committer | Thomas Duval <thomas.duval@orange.com> | 2017-10-29 21:12:28 +0100 |
commit | 63a4316f271a15cc9e9718fbef6f54f2eb05ad20 (patch) | |
tree | 6b3cc9a8a56e7decbd341f49740299be5a7fe041 /moonv4/templates/moonforming/utils/config.py | |
parent | 324009655ea60c5215929fc3ddbe57fd2242c133 (diff) |
Update the moonforming template
Change-Id: I283a414acb2d38ca094bc542dec577b085217cf9
Diffstat (limited to 'moonv4/templates/moonforming/utils/config.py')
-rw-r--r-- | moonv4/templates/moonforming/utils/config.py | 22 |
1 files changed, 22 insertions, 0 deletions
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 |