We’ve been working on a new extension designed to help users dynamically pass environment variables and environment files to applications within the snap sandbox by adding an extension.
We would appreciate any feedback from the community on this.
The documentation for this extension is available at:
The env-injector extension
The env-injector extension adds support for passing user-defined environment variables to snaps.
By adding the extension to snapped apps, the user of the snap will be allowed to set environment variables via snap configuration options or environment files and have them exported to the apps on startup.
Using the extension
Add extensions: [ env-injector ] to the application definition in your snapcraft.yaml file.
Example, adding the extension to an app named server:
a…
The extension is currently under review at:
canonical:main
← locnnil:env-vars-extension
opened 02:26PM - 17 Jul 24 UTC
- [x] Have you followed the [guidelines for contributing](https://github.com/sna… pcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [x] Have you successfully run `tox run -m lint`?
- [x] Have you successfully run `tox run -e test-py310`? (supported versions: `py39`, `py310`, `py311`, `py312`)
-----
Add extension to inject environment variables into snaps by its command-chain.
This extension takes snap options and transform them into environment variables
2 Likes
NOTE : This is currently (October 18, 2024) available on snapcraft
on the edge
channel (rev. number 12915).
sudo snap install snapcraft --edge --classic