Where to place config files, and nested config files
Andreas Hasenack
andreas at canonical.com
Tue Aug 9 21:50:18 UTC 2016
Hi,
I'm starting to use snapcraft and picked squid-deb-proxy as my first
victim. This is just the normal squid service with a set of configuration
files tailored for deb package caching.
I'm assuming that the best place for the squid config files is SNAP_DATA,
because it's versioned and any rollback will include the configuration
files as they were in the previous installed revision. Is that correct?
My other question is about nested configuration files.
This particular squid config file includes other config files via absolute
paths. In the normal deb package, you will see things like this:
acl allowed_networks src "/etc/squid-deb-proxy/allowed-networks-src.acl"
Now even if I point squid to the main/parent config file in SNAP_DATA, that
absolute path above inside the config won't work because it's ouside
SNAP_DATA. So what are my alternatives?
a) hardcode the path above to use this prefix:
/var/snap/squid-deb-proxy/current/. This is just like SNAP_DATA, but using
"current" instead of the revision number, so it's stable. The acl line
above would be like this, for example:
acl allowed_networks src
"/var/snap/squid-deb-proxy/current/etc/squid-deb-proxy/allowed-networks-src.acl"
Can I use "current" like this, or is that abuse or bad form?
b) use a simple template system and dynamically generate the config file
with SNAP_DATA as the prefix before starting the service. I would have
something like this in the template file:
acl allowed_networks src "@PREFIX@
/etc/squid-deb-proxy/allowed-networks-src.acl"
And generate the actual config file replacing @PREFIX@ with the contents of
SNAP_DATA before starting the service. Is this overkill, or the most
elegant solution?
c) something else I'm missing? I'm very much starting my journey here :)
Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20160809/6058f63b/attachment.html>
More information about the Snapcraft
mailing list