Setting configuration variables with dots in names via env vars in Linux
See original GitHub issueDescribe 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:
- Created 5 years ago
- Reactions:2
- Comments:6 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You need to replace
.
with double underscore__
AND you can only have 2 levels of nesting. See #3095Closing in favor of https://github.com/dotnet/runtime/issues/35989. Refer to comment https://github.com/dotnet/runtime/issues/35989#issuecomment-619257166