itzg / docker-minecraft-server

Docker image that provides a Minecraft Server that will automatically download selected version at startup
https://docker-minecraft-server.readthedocs.io/
Apache License 2.0
9.62k stars 1.56k forks source link

Add support for .properties files when patching #2844

Open Player505 opened 6 months ago

Player505 commented 6 months ago

Enhancement Type

Improve an existing feature

Describe the enhancement

I noticed that when trying to set up a patch definition for simple voice chat to change the port it uses the .properties file type isn't recognized

The file format of /data/config/voicechat/voicechat-server.properties could not be identified

It would be nice to get support for these files since a few mods use them

itzg commented 6 months ago

Good idea. It's not going to be a trivial fit since properties files are "unstructured" compared to JSON, Yaml, and Toml; however the concept of the idea is great.

In the meantime, you can make use of variable substitution for managing container driven config file changes like that

https://docker-minecraft-server.readthedocs.io/en/latest/configuration/interpolating/

Player505 commented 6 months ago

Thanks! Yeah I did some more reading of the docs and saw that I could use variable substitution but it was my understanding that I need to provide the config file to the container rather than patching one that it makes?

itzg commented 6 months ago

Yes, by default the variable substitution is performed on files copied over from /config mount. You can have it process existing files with REPLACE_ENV_IN_PLACE however, that'll be a one-time replacement since the variable will be gone after replacement.

Patching requires the file to be patched to be pre-existing, so it sounds like that wasn't going to solve your scenario as is.

Player505 commented 6 months ago

I worked around patching the files by running the container twice. Once to generate the files and the second time to patch them.

I gave it some more thought and the packwiz capability might provide a better solution for my use case since packwiz can also deal with config files. My methodology is that I'd like to reduce the number of files required for reproducibility which is why I didn't want to mount a config folder.

itzg commented 6 months ago

My methodology is that I'd like to reduce the number of files required for reproducibility which is why I didn't want to mount a config folder.

💯