aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornico <nico@magicbroccoli.de>2020-09-18 16:42:36 +0200
committergenofire <geno+dev@fireorbit.de>2020-09-26 22:09:01 +0200
commit714548b0c7d1813c681a5484bbde8ce12e9efedc (patch)
tree034f9d532314e320f10a2519256a3eb2e184dbd8
parentb113b9ce60d41397da697c04bcf901834346af27 (diff)
refactor os.environ to pathlib
* config.py should use the smaller lib to determine which config to load
-rw-r--r--config.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/config.py b/config.py
index d4a7097..b99708f 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,12 @@ 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"):
+ # select config file
+ if Path.exists(Path("config.yml")):
self.conf_file = Path("config.yml")
+ else:
+ self.conf_file = Path("/etc/ejabberd-metrics.yml")
# read config file
self._read()