Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Core Environment variable colon in Linux

In ASP.NET Core nested configuration via environment variables is typically done via colon syntax:

MySettings:SomeSetting=MyNewValue

How do you do this in Linux? The export command rejects the colon? eg:

export MySettings:SomeSetting=MyNewValue

Errors with

bash: export: `MySettings:SomeSetting=MyNewValue': not a valid identifier 
like image 903
fiat Avatar asked Oct 17 '16 20:10

fiat


People also ask

What is Colon in environment variable?

It is a colon-separated list of directories in which the shell looks for commands (see COMMAND EXECUTION below). A zero-length (null) directory name in the value of PATH indicates the current directory.

Can I host ASP.NET Core on Linux?

With ASP.NET Core, you can build and run . NET applications not only on Windows but also macOS and Linux.


1 Answers

Reading the docs carefully:

If : cannot be used in environment variables in your system, replace : with __ (double underscore).

ie:

export MySettings__SomeSetting=MyNewValue 
like image 127
fiat Avatar answered Sep 19 '22 22:09

fiat