Fix: cmd line options overwrite env variable config options
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Fri, 18 May 2018 21:45:57 +0000 (17:45 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 26 May 2018 08:41:33 +0000 (04:41 -0400)
The doc is clear about the order of precedence regarding configuration.

The command line options always override any config file or
configuration by environment variables.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/main.c

index cb9e16ec506e8ffbae652ba4dda670af27a0917d..88877c700437d54713020f4dc06c66f543fe4d67 100644 (file)
@@ -5552,6 +5552,12 @@ int main(int argc, char **argv)
                goto exit_set_signal_handler;
        }
 
+       /*
+        * Init config from environment variables.
+        * Command line option override env configuration per-doc. Do env first.
+        */
+       sessiond_config_apply_env_config(&config);
+
        /*
         * Parse arguments and load the daemon configuration file.
         *
@@ -5566,9 +5572,6 @@ int main(int argc, char **argv)
                goto exit_options;
        }
 
-       /* Init config from environment variables. */
-       sessiond_config_apply_env_config(&config);
-
        /*
         * Resolve all paths received as arguments, configuration option, or
         * through environment variable as absolute paths. This is necessary
This page took 0.027758 seconds and 4 git commands to generate.