[Feature Request] Ability to move save.yml to another directory
coverrt opened this issue · 5 comments
The save.yml
is saved in the root directory of the plugin (plugins/Shopkeepers/
) and cannot be changed.
If you try to persist save.yml
in a Docker volume, you have no choice but to also include the config.yml
file. Since save.yml
is deleted and replaced for each save, bind mounting save.yml
prevents it from being deleted/overwritten so you get something like this..
I changed save.yml
to data/save.yml
and ran the build as a temp workaround.
Would it be possible to add a configuration setting to change the default path?
This sounds like a general issue to me with something (in this case related to Docker) locking and preventing the file from being deleted.
Have you investigated why this file is being locked? Maybe there is a way to configure your setup to not lock it.
Does this issue only affect the directly mounted directory? Wouldn't it be possible to 'bind mount' the entire plugins folder, instead of just the shopkeepers folder?
Is this issue specific to Windows? For instance, I have found this ticket: docker/for-win#525
If you try to persist save.yml in a Docker volume, you have no choice but to also include the config.yml file.
Isn't the config something you would want to persist? Generally, everything inside the plugins data folder is supposed to get persisted. If you do not want that, you could implement your own 'reset' functionality on top, which replaces the config on startup with your desired default config. Moving every file into its own folder because different users may want to persist different combinations of files, and their tool only supports folder granularity, does not seem to be the proper solution to me.
Although moving the save file might resolve your particular issue, it may not resolve the issue in general. For instance, if this issue applies to all files within the shopkeepers plugin folder, the same problem could affect the plugin if it tries to modify the config file (eg. during updates and migrations), or any other files located in that folder (eg. the trading history file, if that feature is enabled; or other files which might be added in the future).
The plugin should therefore be able to modify files within its plugin folder. If something is preventing that, then the proper solution is to investigate there.
Have you investigated why this file is being locked? Maybe there is a way to configure your setup to not lock it.
It was attempted to bind mount the save.yml
file, but it cannot be done with the current save functionality for the plugin.
Isn't the config something you would want to persist? Generally, everything inside the plugins data folder is supposed to get persisted. If you do not want that, you could implement your own 'reset' functionality on top, which replaces the config on startup with your desired default config.
The config is not something we want to persist as all the changes derive from the Docker image. We could implement a reset on each startup for the container, but something native in the plugin that can be controlled by the config inside the Docker image would be way easier to maintain. If you think about a database, the config location and data files are in separate directories.
The plugin should therefore be able to modify files within its plugin folder. If something is preventing that, then the proper solution is to investigate there.
I agree that the plugin should be able to modify files within its plugin folder, but that doesn't mean it can't have additional directories within the plugin folder to separate the data files.
Instead of adding a config option for it I moved the save file for everybody into a new 'data' folder. I assume this is sufficient to resolve your issue?
A snapshot with this change is available here: https://nexus.lichtspiele.org/repository/snapshots/com/nisovin/shopkeepers/Shopkeepers/2.12.1-SNAPSHOT/Shopkeepers-2.12.1-20201114.002121-1.jar