[{"data":1,"prerenderedAt":82},["ShallowReactive",2],{"/2025/10/19-where-is-my-environment-variables-journey-to-linux-service":3},{"id":4,"title":5,"body":6,"date":73,"description":56,"extension":74,"meta":75,"navigation":76,"path":77,"robots":78,"seo":79,"stem":80,"__hash__":81},"posts/2025/10/19 where-is-my-environment-variables-journey-to-linux-service.md","19 Where Is My Environment Variables Journey To Linux Service",{"type":7,"value":8,"toc":71},"minimark",[9,18,25,28,31,33,36,43,57,63],[10,11,13],"post-title",{":date":12},"date",[14,15,17],"h1",{"id":16},"where-is-my-environment-variables-journey-to-linux-service","Where is My Environment Variables? Journey to Linux Service",[19,20,21],"notes",{},[22,23,24],"p",{},"This is a repost from my old blog. First posted in 3/29/2019.",[26,27],"br",{},[22,29,30],{},"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.",[26,32],{},[22,34,35],{},"After hours of googling, turns out systemd service strips all out except some variables. Two ways to fix this:",[37,38,39],"ol",{},[40,41,42],"li",{},"Put the environment variable in the .service config file",[44,45,46],"code-block",{},[47,48,53],"pre",{"className":49,"code":51,"language":52},[50],"language-text","[Service]\nEnvironment=MY_ENV_VAR=thevalue\n","text",[54,55,51],"code",{"__ignoreMap":56},"",[37,58,60],{"start":59},2,[40,61,62],{},"Include /etc/environment in the service. (I don't think this is a good idea, especially for my use case).",[44,64,65],{},[47,66,69],{"className":67,"code":68,"language":52},[50],"[Service]\nEnvironmentFile=/etc/environment\n",[54,70,68],{"__ignoreMap":56},{"title":56,"searchDepth":59,"depth":59,"links":72},[],"2025-09-01T00:00:00.000Z","md",{},true,"/2025/10/19-where-is-my-environment-variables-journey-to-linux-service",null,{"title":5,"description":56},"2025/10/19 where-is-my-environment-variables-journey-to-linux-service","Tjqj5GZHePcB2PyssoiGNZ85Szegr1r6JgbD8HcEOPQ",1785167452808]