zomboid-dedicated-server icon indicating copy to clipboard operation
zomboid-dedicated-server copied to clipboard

Server will overwrite the configuration files on the first time the container is restarted

Open thiagogpa opened this issue 2 years ago • 5 comments

Every time I stop and start the server back up, it overwrites the ZomboidServer.ini and the ZomboidServer_SandboxVars.lua and I would lose all the settings I have, including mods and some other parameters.

If I change back my settings it starts over with the correct settings, next time I stop it it will do the same thing and overwrite the files next time.

How to replicate: I set up the server the first time I just followed the README file, cloned, and started the server from scratch. It boots up an empty instance, I proceed to stop it, changing the configurations on the ZomboidServer.ini and the ZomboidServer_SandboxVars.lua, boot it back up. It then installs all the mods and set everything as I have it on the config files. I manage to log in and play the game normally, with all the mods and everything.

Once I stop it and start it again, it just changes a bunch of stuff on the config files and basically starts again the server from scratch.

image

Tried running without the environment variables to see if that was the reason why but it does the same thing regardless.

I noticed the time I restart it, I get some sort of error pointing out to the RCONPort but that does have a number, so no idea why I get this exception

image

thiagogpa avatar Jun 17 '22 20:06 thiagogpa

I actually just found the cause...

There's a function called apply_postinstall_config under run_server.sh that runs every time the server is restarted and is overwriting the configuration on the Conf files by the default settings on the code.

Not sure that's the best way to do it, I would set the default if it wasn't set on the conf file itself, otherwise, you run into issues as I did.

I may push a change in that sense if that is something that the repository owner might think is worthwhile.

thiagogpa avatar Jun 17 '22 21:06 thiagogpa

Hello, @thiagogpa! Thanks for sharing your issue.

So, the file does get overwritten by the arguments provided, yes. Maybe the easiest solution would be to check if the User has provided an environment variable, and simply not replacing anything if they haven't. The current behaviour replaces everything with default values.

Just to make sure, even if you do provide the environment variables for Mods, Name, and MaxPlayers, the settings that you want don't apply? In the most recent GitHub Action Build the values seem to be successfully changed.

Renegade-Master avatar Jun 18 '22 14:06 Renegade-Master

Yeah, you are correct, If I provide the values on the environmental section they do get populated with whatever I set there, what I was doing was providing the server name only and nothing else.

The "issue" is more because of the way that I change my config file. I find it easier to load the configuration files on the game itself and change whatever I need using the GUI and then just copy-paste it into my server and restart it.

Specifically for me, the way the container works makes it harder for me to have to change the settings in both the YAML and the config files.

I do think having the option to overwrite it directly in the environment is great for people that just set it up once and are done with it, in my case I would benefit if it didn't replace anything as you mentioned.

** I would love to help out by adding that extra "feature" if you feel like it's something you would like on your project

thiagogpa avatar Jun 18 '22 14:06 thiagogpa

Yeah, that makes sense. I didn't really consider people changing their settings often.

** I would love to help out by adding that extra "feature" if you feel like it's something you would like on your project

That is perfectly fine with me! If you have a suggestion you can think of, feel free to create a PR.

Renegade-Master avatar Jun 18 '22 15:06 Renegade-Master

Hello, any changed about this issue so far ?

sullivandavid42 avatar Jun 17 '24 04:06 sullivandavid42