refactor os.environ to pathlib #1
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue