dryven / cookie-byte

Get full control over all your cookie-related settings right in the control panel: Create cookie categories, add code snippets, customise the cookie modal and activate cookie content covers that hide content as long as specific cookie categories are not accepted.
https://statamic.com/addons/dryven/cookie-byte
5 stars 2 forks source link

make the addon work in zero downtime deployment environments #6

Closed dominikfoeger closed 2 years ago

dominikfoeger commented 2 years ago

Problem: base_path() returns a path relative to the applications root directory. Without any customizations (such as custom stache paths in Statamic) this will be overwritten on every deploy in environments where every release has it's own directory.

Solution: Either extend the configuration to be able to alter the storage path for the addon or use storage_path() instead of base_path(), because /storage has to be persisted between releases anyways. In my experience /storage/statamic/addons/[ADDON] is the de facto standard for storing addon data.

dryven-dano commented 2 years ago

Hey @dominikradl! Thanks for your pull request, we haven't thought about this issue before. I have chosen your first solution as it would be quite troublesome to other users that the configPath would suddenly change on all their instances. You can use the config variable cookie-byte.config_dirname now to specify the storage_path('storage/statamic/addons').