Pass argument to snap before/during snap install


#1

Hello everyone,

I am looking for the best solution to pass an argument (e.g. devMode flag) to my application at the time of snap installation. This is necessary because I need to know before the application runs the first time in what kind of mode I am.
It would be great to pass a setting during the install, something like this:

snap install my_snap --dev

I guess this is not available or at least I did not find it. I checked snap set but I think I am not able to set a config value of a snap before installing it.
I’d be interest on best practices on my problem.

Thanks a lot


#2

One way you can do this today is with the defaults key in the gadget.yaml of an Ubuntu Core image.

Regarding passing arguments to installation, I asked about supporting a similar mechanism here: Debugging a snap with failing daemons is difficult


#3

Thanks for your reply. Too bad that there is no solution yet. I might need to come up with some internal workaround. Let me know if you stumble across a nice way to solve this.
Thanks