mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-06 09:13:19 +03:00
🚀 Feature: Embed static assets into binary rather than expecting they exist #422
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @j-baker on GitHub.
Feature description
At present, the backend binary assumes that various resources are available at predetermined paths with respect to the working directory. For example, migrations are expected to be found at
migrations/, images atimages/.It would be convenient if pocket-id used go-embed or similar to bundle all relevant data directly into the binary. An alternative would be to store the assets relative to the binary instead and reference them relative to the binary path and not the working directory, ideally using an FHS style path scheme (e.g.
bin/pocket-id-backend,share/migrations, etc).Pitch
Thanks for writing this service - really like the minimal implementation. I run pocket-id on nixos as a systemd service. I build and package pocketid such that I have a directory scheme which looks like:
I then run the backend in the directory
/var/lib/pocket-id, so I have a working directory that is stable across upgrades. Unfortunately, this errors because the three listed directories are not present. In order for this to work, I have torsync -a $(dirname $(which pocket-id-backend)/../var/ ./to ensure that the static assets are copied across.I would like instead to have a clear separation of 'assets that come with the binary' which can be stored in or alongside the binary, and 'assets provided by the user' which can be stored in the working directory.
@stonith404 commented on GitHub:
Released in
v0.23.0.@stonith404 commented on GitHub:
Thank you for the suggestion! This is my first larger Go project, and I wasn’t aware that resources could be embedded directly into the binary. I’ve updated the code on the main branch to include the static assets from
backend/resourcesas part of the binary.Let me know if there are more changes needed.