Skip to content

server.properties temporary modification system #525

@benbaptist

Description

@benbaptist

That title pretty much makes no sense. Allow me to explain!

While my knowledge of the modern vanilla server.jar is a bit out-of-date, I believe the server.properties file is still only read once: when the server first boots. We can use this to our leverage to modify certain properties for the vanilla server to see, but then revert those changes as soon as the server is fully up-and-running.

In other words, we can make a much simpler, easier-to-setup proxy system (among other things that could benefit from this).

Instead of making the user configure both wrapper.properties.json (setting the "accessable" port that clients connect to, etc.) and server.properties (disabling online-mode, changing server-port to something arbitrary, turning off packet compression, etc.), Wrapper can simply leverage the port already set in server.properties for the Proxy to bind to (BEFORE starting the server!), then temporarily overwrite the existing server.properties with a modified one containing a randomized, open port, online-mode set to false, etc. and by the time the server is fully launched, putting the old server.properties back. The server.jar won't care that the server.properties is different, and thus, the original settings are safe and no problems should arise from this.

It should be noted that every time the server restarts, the server.properties should be re-loaded back into Wrapper's memory (in case the user made adjustments), and the overwriting of server.properties needs to take place just before the actual server.jar is started for this to work.

For extra safety, the old server.properties can always be placed as something like server.properties.bak, and we can have a flag in the temporary, modified one that indicates to Wrapper that this was a modified, temporary file. Then, if something is interrupted DURING the server start and the server.properties remains overwritten, we can perform a check and restore the proper server.properties (with the user-set settings, not the randomized port).

Apologies if this is rather confusingly written. I can elaborate as needed. Also, my apologies if this has already been suggested someplace else. I just did a quick check of the issues tab and didn't see anything like this. But this is one of the features I had been intending to implement since the days when I was still actively maintaining this project.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions