aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornico <mightybroccoli@noreply.%(DOMAIN)s>2020-11-06 12:07:37 +0100
committernico <mightybroccoli@noreply.%(DOMAIN)s>2020-11-06 12:07:37 +0100
commitc2b190b18bd2fb7bbea643c38d9992581eb5a5b4 (patch)
tree6daa023404b506983d4291188bc5c7aec80abe55
parentb113b9ce60d41397da697c04bcf901834346af27 (diff)
parenta9e9f2e174f81979e40f42a6440159f2ee1e2ed4 (diff)
Merge pull request 'refactor os.environ to pathlib' (#1) from configpath into master
Reviewed-on: https://dev.sum7.eu/sum7/ejabberd-tools/pulls/1
-rw-r--r--config.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/config.py b/config.py
index d4a7097..ee72f1c 100644
--- a/config.py
+++ b/config.py
@@ -1,7 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
-from os import environ
from pathlib import Path
from ruamel.yaml import YAML
@@ -13,11 +12,11 @@ class Config:
def __init__(self):
# class variables
self.content = None
- self.conf_file = Path("/etc/ejabberd-metrics.yml")
- # dev config overwrite
- if environ.get("ejabberd_metrics_dev"):
- self.conf_file = Path("config.yml")
+ # select config file
+ self.conf_file = Path("config.yml")
+ if not Path.exists(self.conf_file):
+ self.conf_file = Path("/etc/ejabberd-metrics.yml")
# read config file
self._read()