I have created a snap and the software inside it reads certain configuration values from environment variables. I see that I can read environment variables this way and I am able to set environment variables at compile time by specifying them in snapcraft.yaml however I haven’t been able to find any documentation on how to change environment variables after installing the snap.
Did you manage to find an answer to your problem? I am having the same requirement. I need to set an environment variable in a snap application. It looks like I could go and maintain one of the files inside the snap under /snap, but that does not seem right and the next time the snap updates, I won’t have that change in the new snap version.
The standard way is to write a shell script to launch your application. This shell script can export the environment variables you require based on settings supplied to snapd via snap set. The script accesses these settings by calling snapctl get.