question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting configuration variables with dots in names via env vars in Linux

See original GitHub issue

Describe the bug

Can’t configure using environment variables when configuration variable name contains a dot on Linux. An example of the need for this is setting the log level of classes in nested namespaces

To Reproduce

Steps to reproduce the behavior: Running the project in logging_env_test.tar.gz with: Logging__LogLevel__logging_env_test=Trace Logging__LogLevel__logging_env_test_nested=Error dotnet run

prints:

[...]
trce: logging_env_test.nested.LoggedClass[0]
      LogTrace
dbug: logging_env_test.nested.LoggedClass[0]
      LogDebug
info: logging_env_test.nested.LoggedClass[0]
      Information
warn: logging_env_test.nested.LoggedClass[0]
      LogWarning
fail: logging_env_test.nested.LoggedClass[0]
      LogError
crit: logging_env_test.nested.LoggedClass[0]
      LogCritical
[...]

Tested on aspnet core 2.1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
Rick-Andersoncommented, Mar 19, 2020

You need to replace . with double underscore __ AND you can only have 2 levels of nesting. See #3095

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exporting a variable with dot (.) in it
To sum up, best is to stick with variable names supported by most shells and even try to use upper case for environment...
Read more >
bash - Create environment variable with dot in the current ...
I know that you can create environment variables with the command env . For example: env A.B=D bash. The problem is for env...
Read more >
macos - How do I set an environmental variable with a dot?
My suggestion would be to create the environment variable with an underscore instead, and possibly use UPPERCASE words, as it's common ...
Read more >
Environment variables with dots - Feedback & Bug Reports
It is not possible to set environment variables with dots in their name. If you try to set one in the UI, it...
Read more >
How to set environment variables separated by dots
Is there a work around ? I found somewhere that we can use env variable but that doesnt seem to work. I used...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found