Discussion:
Injecting an environment variable in service
Ruben Vestergaard
2021-03-17 08:57:45 UTC
Permalink
Hi list,

Is there a general way of injecting an environment variable into an rc
managed service? I need Smokeping to pick up the HTTPS_CA_FILE variable,
but there seems to be no obvious way to set it.

I guess I could modify the system scripts, but is there a cleaner,
obvious way I have missed?

Thanks!
-R
Antoine Jacoutot
2021-03-17 10:08:35 UTC
Permalink
Post by Ruben Vestergaard
Hi list,
Is there a general way of injecting an environment variable into an rc
managed service? I need Smokeping to pick up the HTTPS_CA_FILE variable, but
there seems to be no obvious way to set it.
I guess I could modify the system scripts, but is there a cleaner, obvious
way I have missed?
Sure, you can create a login class that matches the rc.d script name and add the
env var in it.

e.g. login.conf entry

smokeping:\
:setenv=HTTPS_CA_FILE=foo:\
:tc=daemon:

FYI you have an example in the smokeping package README.
--
Antoine
Ruben Vestergaard
2021-03-17 11:18:09 UTC
Permalink
Post by Antoine Jacoutot
Post by Ruben Vestergaard
Hi list,
Is there a general way of injecting an environment variable into an rc
managed service? I need Smokeping to pick up the HTTPS_CA_FILE variable, but
there seems to be no obvious way to set it.
I guess I could modify the system scripts, but is there a cleaner, obvious
way I have missed?
Sure, you can create a login class that matches the rc.d script name and add the
env var in it.
e.g. login.conf entry
smokeping:\
:setenv=HTTPS_CA_FILE=foo:\
Brilliant, just what I was looking for! Thanks!
Post by Antoine Jacoutot
FYI you have an example in the smokeping package README.
So there is indeed. *redface.wav*

Cheers,
-R
Post by Antoine Jacoutot
--
Antoine
Continue reading on narkive:
Loading...