From fed974e0187d3db69009fe7cbecc97942368a4e8 Mon Sep 17 00:00:00 2001 From: Unrud Date: Wed, 24 May 2017 17:03:48 +0200 Subject: [PATCH 1/2] Disable logging config by default Radicale always tries to load the system-wide configuration file. To turn this off, the logging-config option has to be added to all configuration files and command line arguments. It's easier to disable it by default and only add it once to the system-wide config file. --- config | 2 +- radicale/config.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config b/config index a0b04f97..0d17daed 100644 --- a/config +++ b/config @@ -122,7 +122,7 @@ # If no config is given, simple information is printed on the standard output # For more information about the syntax of the configuration file, see: # http://docs.python.org/library/logging.config.html -#config = /etc/radicale/logging +#config = # Set the default logging level to debug #debug = False diff --git a/radicale/config.py b/radicale/config.py index d7b4586a..b49e19f2 100644 --- a/radicale/config.py +++ b/radicale/config.py @@ -123,7 +123,7 @@ INITIAL_CONFIG = OrderedDict([ "help": "command that is run after changes to storage"})])), ("logging", OrderedDict([ ("config", { - "value": "/etc/radicale/logging", + "value": "", "help": "logging configuration file"}), ("debug", { "value": "False", From d2a17c36ae7b467efa329739d59ffa909dded7b9 Mon Sep 17 00:00:00 2001 From: Unrud Date: Wed, 24 May 2017 20:49:27 +0200 Subject: [PATCH 2/2] Fail if configuration is not found If a configuration file is passed with a command line argument and the file is not found, Radicale shows a warning and continues with the default configuration. There is no reason for doing this, Radicale should just fail. Instead, this PR allows passing an empty string like ``--config ""``. Radicale will use the default configuration in this case, without trying to load the configuration from the common paths. Previously you had to do specify a path that doesn't exist like ``--config /does/not/exist``, which looks a bit ugly and showed a warning message. --- radicale/__main__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/radicale/__main__.py b/radicale/__main__.py index 7b248705..cc406f99 100644 --- a/radicale/__main__.py +++ b/radicale/__main__.py @@ -74,9 +74,12 @@ def run(): group.add_argument(*args, **kwargs) args = parser.parse_args() - if args.config: + if args.config is not None: configuration = config.load() - configuration_found = configuration.read(args.config) + if args.config: + configuration_found = configuration.read(args.config) + else: + configuration_found = True else: configuration_paths = [ "/etc/radicale/config", @@ -101,7 +104,8 @@ def run(): # Log a warning if the configuration file of the command line is not found if not configuration_found: - logger.warning("Configuration file '%s' not found" % args.config) + logger.error("Configuration file '%s' not found" % args.config) + exit(1) try: serve(configuration, logger)