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:40:07 +0000 (04:40 -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 3d2cad9361464534128a44f5917d01f1e58899fe..e032e037c3ebf933f0caa216cd292578fbb7e9ae 100644 (file)
@@ -5830,6 +5830,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.
         *
@@ -5844,9 +5850,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.027148 seconds and 4 git commands to generate.