mirror of
https://github.com/craigerl/aprsd.git
synced 2025-02-20 04:32:15 -05:00
Merge pull request #63 from craigerl/dump_config
Dump out the config during startup
This commit is contained in:
commit
13be30f772
@ -445,6 +445,7 @@ def server(
|
||||
|
||||
if not quiet:
|
||||
click.echo("Load config")
|
||||
|
||||
config = utils.parse_config(config_file)
|
||||
|
||||
# Force setting the config to the modules that need it
|
||||
@ -460,6 +461,14 @@ def server(
|
||||
else:
|
||||
LOG.info(msg)
|
||||
|
||||
flat_config = utils.flatten_dict(config)
|
||||
LOG.info("Using CONFIG values:")
|
||||
for x in flat_config:
|
||||
if "password" in x or "aprsd.web.users.admin" in x:
|
||||
LOG.info("{} = XXXXXXXXXXXXXXXXXXX".format(x))
|
||||
else:
|
||||
LOG.info("{} = {}".format(x, flat_config[x]))
|
||||
|
||||
if config["aprsd"].get("trace", False):
|
||||
trace.setup_tracing(["method", "api"])
|
||||
LOG.info("APRSD Started version: {}".format(aprsd.__version__))
|
||||
|
@ -1,5 +1,6 @@
|
||||
"""Utilities and helper functions."""
|
||||
|
||||
import collections
|
||||
import errno
|
||||
import functools
|
||||
import logging
|
||||
@ -394,3 +395,15 @@ def _check_version():
|
||||
# Lets put up an error and move on. We might not
|
||||
# have internet in this aprsd deployment.
|
||||
return 1, "Couldn't check for new version of APRSD"
|
||||
|
||||
|
||||
def flatten_dict(d, parent_key="", sep="."):
|
||||
"""Flatten a dict to key.key.key = value."""
|
||||
items = []
|
||||
for k, v in d.items():
|
||||
new_key = parent_key + sep + k if parent_key else k
|
||||
if isinstance(v, collections.MutableMapping):
|
||||
items.extend(flatten_dict(v, new_key, sep=sep).items())
|
||||
else:
|
||||
items.append((new_key, v))
|
||||
return dict(items)
|
||||
|
Loading…
Reference in New Issue
Block a user