Where is My Environment Variables? Journey to Linux Service

Ok, I had a .NET Core Web App running in Ubuntu behind Nginx. Everything else is fine except I can't retrieve the value of the environment variables that I put in /etc/environment.

After hours of googling, turns out systemd service strips all out except some variables. Two ways to fix this:

1. Put the environment variable in the .service config file

[Service]
Environment=MY_ENV_VAR=thevalue

2. Include /etc/environment in the service. (I don't think this is a good idea, especially for my use case).

[Service]
EnvironmentFile=/etc/environment


Comments

Popular posts from this blog

Sentinel One Strikes Again. No internet connection. Uninstall Sentinel One Agent.

A2 Hosting Let's Encrypt Can't Install Certificate on ASP.NET Core Application

NuGet Package Reference NU6105 Publish Error