[Feature Request] Allow users to set a custom 'serversettings.json' path
Is your feature request related to a problem? Please describe.
At this moment, I believe there is no way to set a custom path for the serversettings.json
For the config.txt this is possible by adding -Dconfig to the command line, but for serversettings.json this is not possible.
Describe the solution you'd like
I would like to see a new command line argument called -Dserversettings which can point to a location where the serversettings.json should be saved, similar to -Dconfig which points to the config.txt
Describe the basic flow/steps of using this feature How this feature would be used:
- Users will obtain the ability to set a custom
serversettings.jsonpath using -Dserversettings
Additional context none
Please check the following links to confirm that your feature has not already been requested: https://github.com/jagrosh/MusicBot/labels/enhancement https://github.com/jagrosh/MusicBot/wiki/Things-That-Won%27t-Be-Added
As a workaround, I think you should be able to change your current directory using cd. since it tries using the serversettings.json from your current directory
As a workaround, I think you should be able to change your current directory using
cd. since it tries using the serversettings.json from your current directory
Thanks, looking into it;
I start a JMusicBot instance with init (start-stop-daemon) automatically on a machine, but by default it runs from /, I didn't notice this has a --chdir argument, so I've added that now and that works.
So that works, which is great! But, the more flexability you have from the command line the better in my opinion
Alternatively, if you're on Linux, you could create a symbolic link.
For anyone running a system with systemd, you can work around this by setting the WorkingDirectory attribute under [Service] in your .service file.
As an example, I use /var/opt/musicbot as my working directory, and can change the service to this as follows:
WorkingDirectory=/var/opt/musicbot
One reason you might want this is if you are deploying the bot via Kubernetes, and you wish for the serverSettings.json to be located in a persistent volume. Creating a symbolic link when building the Docker image works well. Something like:
Dockerfile:
ARG SERVER_SETTINGS_PATH="/path/to/some/future/volume"
# ...snip...
RUN mkdir -p $SERVER_SETTINGS_PATH && \
touch $SERVER_SETTINGS_PATH/serversettings.json && \
ln -s $SERVER_SETTINGS_PATH/serversettings.json serversettings.json
deployment.yaml:
apiVersion: apps/v1
kind: Deployment
metadata:
name: jmusicbot
labels:
app: jmusicbot
spec:
replicas: 1
selector:
matchLabels:
app: jmusicbot
template:
metadata:
labels:
app: jmusicbot
spec:
containers:
- name: jmusicbot
image: your_image_here
volumeMounts:
- name: serversettings-dir
mountPath: /path/to/some/future/volume
volumes:
- name: serversettings-dir
persistentVolumeClaim:
claimName: my-persistent-volume-claim