mirror of
https://github.com/craigerl/aprsd.git
synced 2024-09-28 08:06:37 -04: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:
|
if not quiet:
|
||||||
click.echo("Load config")
|
click.echo("Load config")
|
||||||
|
|
||||||
config = utils.parse_config(config_file)
|
config = utils.parse_config(config_file)
|
||||||
|
|
||||||
# Force setting the config to the modules that need it
|
# Force setting the config to the modules that need it
|
||||||
@ -460,6 +461,14 @@ def server(
|
|||||||
else:
|
else:
|
||||||
LOG.info(msg)
|
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):
|
if config["aprsd"].get("trace", False):
|
||||||
trace.setup_tracing(["method", "api"])
|
trace.setup_tracing(["method", "api"])
|
||||||
LOG.info("APRSD Started version: {}".format(aprsd.__version__))
|
LOG.info("APRSD Started version: {}".format(aprsd.__version__))
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
"""Utilities and helper functions."""
|
"""Utilities and helper functions."""
|
||||||
|
|
||||||
|
import collections
|
||||||
import errno
|
import errno
|
||||||
import functools
|
import functools
|
||||||
import logging
|
import logging
|
||||||
@ -394,3 +395,15 @@ def _check_version():
|
|||||||
# Lets put up an error and move on. We might not
|
# Lets put up an error and move on. We might not
|
||||||
# have internet in this aprsd deployment.
|
# have internet in this aprsd deployment.
|
||||||
return 1, "Couldn't check for new version of APRSD"
|
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