mbround18 / palworld-docker

🌟 Welcome to the ultimate Palworld Server Setup! 🌍 This GitHub repository is your go-to toolkit πŸ› οΈ for launching a Palworld server in a snap using Docker! Choose from preset worlds like 'casual' πŸ–οΈ, 'normal' πŸŒ†, or 'hard' πŸŒ‹, or dive deep into customization with flexible settings πŸŽ›οΈ.
https://dev.to/mbround18/dockerize-your-palworld-server-a-step-by-step-guide-1d02
BSD 3-Clause "New" or "Revised" License
24 stars 4 forks source link

Presets not applying #5

Closed salinas707 closed 9 months ago

salinas707 commented 9 months ago

It seems like the presets (casual, normal, hard) are not applying correctly. New to python so I may be wrong, but I think there may be a typo on the config.py script here:

# Check for preset and apply preset values first
    preset_values = {}
    if args.preset:
        preset_values = presets.get(args.preset, {})

    # Create a dictionary of all arguments
    args_dict = {
        key: value
        for key, value in vars(args).items()
        if key != "output" and value is not None
    }
    combined_values = {**preset_values, **args_dict}

    # Load and render the template with arguments
    # get a path of script
    script_path = os.path.dirname(os.path.realpath(__file__))
    # join a script path to templates/config.ini.j2
    template_path = os.path.join(script_path, "templates/config.ini.j2")

    template = Template(open(template_path).read())
    rendered = template.render(**args_dict)

On this line:

rendered = template.render(**args_dict)  # should pass in combined_values rather than args_dict?
mbround18 commented 9 months ago

You are correct! I'll get the change in and test tomorrow :)

mbround18 commented 9 months ago

@salinas707 this has been fixed in the latest push of the container. I had to separate the default values from the env lookup. So the order of operations is default + preset + user set which will = full set of env vars.

mbround18 commented 9 months ago

Tested and confirmed

salinas707 commented 9 months ago

nice work, your changes worked for me. Thank you

cwc commented 9 months ago

The PRESET env does not appear to be working for me. I believe the problem is here: https://github.com/mbround18/palworld-docker/blob/main/scripts/config.py#L176

It looks like the --preset arg does not default to the PRESET env var, and I don't see anywhere else where it would be getting passed in.