Skip to content

Commit

Permalink
Fixed verbosity and quitness being overridden by config file values
Browse files Browse the repository at this point in the history
  • Loading branch information
markqvist committed Jan 27, 2023
1 parent 2bb3417 commit a64f3a5
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions LXMF/Utilities/lxmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,6 @@ def program_setup(configdir = None, rnsconfigdir = None, run_pn = False, on_inbo
global lxmd_config, active_configuration, targetloglevel
global message_router, lxmf_destination

targetloglevel = 3+verbosity-quietness

if service:
targetlogdest = RNS.LOG_FILE
targetloglevel = None
Expand Down Expand Up @@ -234,22 +232,29 @@ def program_setup(configdir = None, rnsconfigdir = None, run_pn = False, on_inbo
if not os.path.isdir(lxmdir):
os.makedirs(lxmdir)

if not os.path.isfile(configpath):
RNS.log("Could not load config file, creating default configuration file...")
create_default_config(configpath)
RNS.log("Default config file created. Make any necessary changes in "+configpath+" and restart lxmd if needed.")
time.sleep(1.5)

if os.path.isfile(configpath):
try:
lxmd_config = ConfigObj(configpath)
except Exception as e:
RNS.log("Could not parse the configuration at "+configpath, RNS.LOG_ERROR)
RNS.log("Check your configuration file for errors!", RNS.LOG_ERROR)
RNS.panic()
else:
RNS.log("Could not load config file, creating default configuration file...")
create_default_config(configpath)
RNS.log("Default config file created. Make any necessary changes in "+configpath+" and restart Reticulum if needed.")
time.sleep(1.5)


apply_config()
RNS.log("Configuration loaded from "+configpath, RNS.LOG_VERBOSE)

if targetloglevel == None:
targetloglevel = 3

if verbosity != 0 or quietness != 0:
targetloglevel = targetloglevel+verbosity-quietness

# Start Reticulum
RNS.log("Substantiating Reticulum...")
reticulum = RNS.Reticulum(configdir=rnsconfigdir, loglevel=targetloglevel, logdest=targetlogdest)
Expand Down

0 comments on commit a64f3a5

Please sign in to comment.