projects
/
osm
/
POL.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bug 2113 fix: POL upgrade from v10.1.1 to v12.0.0 fails due to changes in databases
[osm/POL.git]
/
osm_policy_module
/
core
/
config.py
diff --git
a/osm_policy_module/core/config.py
b/osm_policy_module/core/config.py
index
e482ec8
..
1bc9b2b
100644
(file)
--- a/
osm_policy_module/core/config.py
+++ b/
osm_policy_module/core/config.py
@@
-33,17
+33,17
@@
logger = logging.getLogger(__name__)
class Config:
class Config:
- def __init__(self, config_file: str =
''
):
+ def __init__(self, config_file: str =
""
):
self.conf = {}
self._read_config_file(config_file)
self._read_env()
def _read_config_file(self, config_file):
if not config_file:
self.conf = {}
self._read_config_file(config_file)
self._read_env()
def _read_config_file(self, config_file):
if not config_file:
- path =
'pol.yaml'
+ path =
"pol.yaml"
config_file = pkg_resources.resource_filename(__name__, path)
with open(config_file) as f:
config_file = pkg_resources.resource_filename(__name__, path)
with open(config_file) as f:
- self.conf = yaml.load(f)
+ self.conf = yaml.
safe_
load(f)
def get(self, section, field=None):
if not field:
def get(self, section, field=None):
if not field:
@@
-63,10
+63,12
@@
class Config:
if len(elements) < 3:
logger.warning(
"Environment variable %s=%s does not comply with required format. Section and/or field missing.",
if len(elements) < 3:
logger.warning(
"Environment variable %s=%s does not comply with required format. Section and/or field missing.",
- env, os.getenv(env))
+ env,
+ os.getenv(env),
+ )
continue
section = elements[1]
continue
section = elements[1]
- field =
'_'
.join(elements[2:])
+ field =
"_"
.join(elements[2:])
value = os.getenv(env)
if section not in self.conf:
self.conf[section] = {}
value = os.getenv(env)
if section not in self.conf:
self.conf[section] = {}