Getting http_proxy var into a snap service

Andreas Hasenack andreas at canonical.com
Tue Sep 6 21:25:35 UTC 2016


Hi,

On Xenial, I just had to debug an issue where a snap service wasn't getting
the proxy variables set.

i traditionally set these variables in /etc/environment, and that usually
worked.

Some googling led me to
https://bugs.launchpad.net/ubuntu/+source/lxd/+bug/1557161 where a similar
problem was encountered, and the solution/workaround was to suck in
/etc/environment via EnvironmentFile. So that's what I did:

[Service]
...
EnvironmentFile=-/etc/environment
Environment="SNAP=/snap/....  "

Then the service got the proxy variables, and worked.

That file is provided by snappy, however, and not something that the snap
developer controls with that level of detail I believe. Having the
sysadm/user add an override file for just that service is also possible,
but it's a bit more complicated than it should be I think.

Finally, snappy would probably want to be very careful about the shell
variables it imports into a snap.

What would be the best way to make sure a snap gets the proxy variables it
might need to work? Maybe I completely misunderstood how to set a proxy
system-wide in Xenial?

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20160906/44068c87/attachment.html>


More information about the Snapcraft mailing list