4

I'm currently working on a server side app written in Golang. I want to package the app in a snap package.

Where can I store a global configuration file for the app that retains itself even after an upgrade?

Some sample code would be nice, thanks!

Evan Lin
  • 79
  • 1
  • 6

1 Answers1

5

All info you need regarding where snap can read/write files can be found in this post: Where can Ubuntu snaps write data?

From your question it seems you will be most interested in SNAP_COMMON folder.

Jasko
  • 115
  • 2
    Where is the SNAP_COMMON folder? Is SNAP_COMMON an environmental variable? – Evan Lin Apr 17 '17 at 20:59
  • 2
    it's env variable but only valid from within the snap. You will not be able to get it from the system itself as it is snap dependent. To get it run your snap as 'snap run --shell '. You can run 'env | grep SNAP' once inside and see proper location of SNAP_COMMON folder. It should be like this: 'SNAP_COMMON=/var/snap//common' – Jasko Apr 18 '17 at 20:59