Title
#fleet
Mystery Incorporated

Mystery Incorporated

08/02/2021, 2:47 PM
So that answer is that, FLEET does not use global environment variables
Rachel Perkins

Rachel Perkins

08/02/2021, 2:48 PM
FWIW, I usually set my software inventory variable in my dev build command.
FLEET_BETA_SOFTWARE_INVENTORY=1 ./build/fleet serve --dev
Mystery Incorporated

Mystery Incorporated

08/02/2021, 2:49 PM
I am guessing you are using docker?
2:50 PM
I guess that stuffs the env var into your docker environment? I am not super familiar with docker tho, if I can run stuff natively I try to do that to eliminate overhead
Rachel Perkins

Rachel Perkins

08/02/2021, 2:54 PM
Yeah, we recommend docker for our dev environment
Stefano Bonicatti

Stefano Bonicatti

08/02/2021, 2:55 PM
Btw, the availability of an environment variable is not controlled by the process that needs to access it (Fleet), but it's controlled by who (what other process/context) is launching such process. In the case of systemd, as other have said, you have to set the env var there. If you had launched it from bash, then it would've inherited those env vars.
Tomas Touceda

Tomas Touceda

08/02/2021, 2:56 PM
what Stefano mentions is correct. That said, we should add that to the systemd documentation @Rachel Perkins
Mystery Incorporated

Mystery Incorporated

08/02/2021, 3:00 PM
@Stefano Bonicatti indeed, I figured the variable was only going to bash, that's what I meant by fancy pants method, as in some way to give the fleet process the environment variable, because it is not reading it from /etc/environment (the global environment variables for all processes). Bash specific environment variables go in .bash_profile or .profile etc So when something says "set environment variable" and doesn't specify local or global, I would think it would read the global env vars. But maybe that is a limitation of systemd not fleet which is what I think you are saying?
3:05 PM
@Rachel Perkins probably explains why it won't build for me, I guess i could probably build it in the docker container and then use the binary natively like I am doing if I decide to build it, which i really should as I build everything else I use.
Stefano Bonicatti

Stefano Bonicatti

08/02/2021, 3:15 PM
@Mystery Incorporated I wouldn't necessarily call it a limitation, it's a choice of systemd, since it doesn't want to rely on PAM to read that file. But in general, what I was trying to say is that if any process is not receiving environment variables, you have to look into what's the parent process and check how it works/how it passes env vars.