-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug Report] Environment variable settings do not apply if PalWorldSettings.ini does not contain the variable #195
Comments
I believe this will become a bigger issue in the future if Pocketpair decide to add new configuration values to Palworld in new updates. |
Hey @Callum027
This is litteraly what i do, IF the config does not exists, for backwards compability:
What do you mean by that? I dont understand what you mean, please elaborate/reforumalte. |
If you go a little further up to
So the current Here's an example of how it might be done for if grep "Difficulty=[a-zA-Z]*" "$GAME_SETTINGS_FILE" > /dev/null 2>&1; then
sed -E -i "s/Difficulty=[a-zA-Z]*/Difficulty=$DIFFICULTY/" "$GAME_SETTINGS_FILE"
else
sed -E -i "s/)$/,Difficulty=$DIFFICULTY)/" "$GAME_SETTINGS_FILE"
fi |
Hey @Callum027
Oh so your request is bascially, ALWAYS copy the new default and change it?
I seed the code and see no difference, the values gets overwritten anyways, i dont see a change to what i have. Not sure what you want to do here. Sorry, maybe im blind or dumb, but i dont get it. |
Not necessarily. I just thought this would be the easiest way to solve this issue. The disadvantage is that users cannot modify
So here I'm proposing an alternative to "ALWAYS copy the new default and change it", as explained above. Here is the current implementation for the if [[ -n ${DIFFICULTY+x} ]]; then
e "> Setting Difficulty to '$DIFFICULTY'"
sed -E -i "s/Difficulty=[a-zA-Z]*/Difficulty=$DIFFICULTY/" "$GAME_SETTINGS_FILE"
fi In this alternative solution, I'm proposing we could change it (effectively) to: if [[ -n ${DIFFICULTY+x} ]]; then
e "> Setting Difficulty to '$DIFFICULTY'"
if grep "Difficulty=[a-zA-Z]*" "$GAME_SETTINGS_FILE" > /dev/null 2>&1; then
# If the `Difficulty` field already exists in `PalWorldSettings.ini`, overwrite it.
sed -E -i "s/Difficulty=[a-zA-Z]*/Difficulty=$DIFFICULTY/" "$GAME_SETTINGS_FILE"
else
# If the `Difficulty` field does not exist in `PalWorldSettings.ini`, add it to the end of the file.
sed -E -i "s/)$/,Difficulty=$DIFFICULTY)/" "$GAME_SETTINGS_FILE"
fi
fi This makes the code more complicated (we can simplify this using functions), but it would fix the issue while also preserving the ability for users to manually add fields to the file. |
I'm fine with any solution you're happy with, I just wanted to propose some things and hear your thoughts. |
Yeah sure im all ears for that. I added now copy Default to location and sed-search-and-replace. Your version for modifications in a manual way we have covered, its manual mode, there the script doesnt do anything. Im open to later feedback, but lets go with this first. |
Sounds reasonable. Thanks for fixing the issue, and thanks for listening to my suggestions, appreciate it. |
Have you read the Important information text above
Current behavior
When a configuration field is not defined in
PalWorldSettings.ini
, the container cannot apply any values set using the environment variables, since thesed
commands used to apply the settings only do in-place edits of existing fields, not inserts. SincePalWorldSettings.ini
already exists, the container doesn't override it.I tried to set
RCONEnabled
andRCONPort
using environment variables, but since they weren't defined inPalWorldSettings.ini
they were ignored.Desired behavior
All values set by environment variables should be actually applied, regardless of the current state of the configuration file.
I think there are two possible solutions:
PalWorldSettings.ini
withDefaultPalWorldSettings.ini
on startup, and overwrite the defaults with values set in the environment variables.PalWorldSettings.ini
, so this would basically be the ideal solution.Links to screenshots
No response
To Reproduce
Steps to reproduce the behavior:
PalWorldSettings.ini
.Software setup
Hardware setup
Additional context
I migrated my Palworld Dedicated Server setup over from a non-containerised installation, where in
PalWorldSettings.ini
I only set the values I wanted to override. This is why thePalWorldSettings.ini
file is not a complete copy of the defaults file.The text was updated successfully, but these errors were encountered: