From 8c3ac4060f90b3c8a2a0b2fe6f9c4bff56a41279 Mon Sep 17 00:00:00 2001 From: Darksider3 Date: Sat, 19 Oct 2019 14:02:52 +0200 Subject: [PATCH] Split CFG.py to private/lib/cfgparse.py --- private/lib/CFG.py | 16 +++++----------- private/lib/cfgparse.py | 12 ++++++++++++ 2 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 private/lib/cfgparse.py diff --git a/private/lib/CFG.py b/private/lib/CFG.py index bb10f35..55d2a71 100644 --- a/private/lib/CFG.py +++ b/private/lib/CFG.py @@ -1,12 +1,6 @@ -import configparser -import logging -import lib.uis.default as default_cmd +import lib.cfgparse -args = default_cmd.argparser.parse_args() -CONF_FILE = args.config -config = configparser.ConfigParser() -config.read(CONF_FILE) -logging.basicConfig(format="%(asctime)s: %(message)s", - level=int(config['LOG_LEVEL']['log_level']) - ) -REG_FILE = config['DEFAULT']['applications_db'] +args = lib.cfgparse.args +CONF_FILE = lib.cfgparse.CONF_FILE +config = lib.cfgparse.config +REG_FILE = lib.cfgparse.REG_FILE \ No newline at end of file diff --git a/private/lib/cfgparse.py b/private/lib/cfgparse.py new file mode 100644 index 0000000..bb10f35 --- /dev/null +++ b/private/lib/cfgparse.py @@ -0,0 +1,12 @@ +import configparser +import logging +import lib.uis.default as default_cmd + +args = default_cmd.argparser.parse_args() +CONF_FILE = args.config +config = configparser.ConfigParser() +config.read(CONF_FILE) +logging.basicConfig(format="%(asctime)s: %(message)s", + level=int(config['LOG_LEVEL']['log_level']) + ) +REG_FILE = config['DEFAULT']['applications_db']