All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH lttng-tools] Fix: cmd line options overwrite env variable config options
@ 2018-05-18 21:45 Jonathan Rajotte
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Rajotte @ 2018-05-18 21:45 UTC (permalink / raw)
  To: lttng-dev; +Cc: jgalar

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>
---
 src/bin/lttng-sessiond/main.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c
index 37c0a932..de8df2e0 100644
--- a/src/bin/lttng-sessiond/main.c
+++ b/src/bin/lttng-sessiond/main.c
@@ -5775,6 +5775,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.
 	 *
@@ -5789,9 +5795,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
-- 
2.17.0

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH lttng-tools] Fix: cmd line options overwrite env variable config options
       [not found] <20180518214557.6933-1-jonathan.rajotte-julien@efficios.com>
@ 2018-05-26  8:43 ` Jérémie Galarneau
  0 siblings, 0 replies; 2+ messages in thread
From: Jérémie Galarneau @ 2018-05-26  8:43 UTC (permalink / raw)
  To: Jonathan Rajotte; +Cc: lttng-dev, Jeremie Galarneau


[-- Attachment #1.1: Type: text/plain, Size: 1730 bytes --]

Merged in master and stable-2.10 with a minor fix.

Thanks!
Jérémie


On 18 May 2018 at 17:45, Jonathan Rajotte <
jonathan.rajotte-julien@efficios.com> wrote:

> 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>
> ---
>  src/bin/lttng-sessiond/main.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c
> index 37c0a932..de8df2e0 100644
> --- a/src/bin/lttng-sessiond/main.c
> +++ b/src/bin/lttng-sessiond/main.c
> @@ -5775,6 +5775,12 @@ int main(int argc, char **argv)
>                 goto exit_set_signal_handler;
>         }
>
> +       /*
>

There's a trailing whitespace here ^.


> +        * 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.
>          *
> @@ -5789,9 +5795,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
> --
> 2.17.0
>
>


-- 
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com

[-- Attachment #1.2: Type: text/html, Size: 2722 bytes --]

[-- Attachment #2: Type: text/plain, Size: 156 bytes --]

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-26  8:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-18 21:45 [PATCH lttng-tools] Fix: cmd line options overwrite env variable config options Jonathan Rajotte
     [not found] <20180518214557.6933-1-jonathan.rajotte-julien@efficios.com>
2018-05-26  8:43 ` Jérémie Galarneau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.