pterodactyl / panel

Pterodactyl® is a free, open-source game server management panel built with PHP, React, and Go. Designed with security in mind, Pterodactyl runs all game servers in isolated Docker containers while exposing a beautiful and intuitive UI to end users.
https://pterodactyl.io
Other
6.7k stars 1.7k forks source link

YAML Configuration Files are broken when starting the server #4236

Closed Lenni0451 closed 2 years ago

Lenni0451 commented 2 years ago

Current Behavior

I have these values in the config file: grafik

After starting the server the config values y and n are replaced with "true" and "false" like shown here: grafik

Expected Behavior

The keys of the YAML config are not replaced with true and false

Steps to Reproduce

I used this egg when I noticed this issue.

Steps:

  1. Import the egg
  2. Install a server using the NanoLimbo egg
  3. Start the server and edit the config
  4. The config key "spawnPosition.y" has been replaced with "spawnPosition."true"" (The n option was added by me)

Panel Version

1.9.2

Wings Version

1.6.4

Games and/or Eggs Affected

https://github.com/parkervcp/eggs/blob/master/game_eggs/minecraft/java/nanolimbo/egg-nano-limbo.json

Docker Image

No response

Error Logs

No response

Is there an existing issue for this?

PoQuatre commented 2 years ago

I have the same issue with NanoLimbo's config file in Panel version 1.10.1 and Wings version 1.7.0

PoQuatre commented 2 years ago

After some quick digging around, I found out that if I change the Configuration Files section of NanoLimbo's egg from:

{
    "settings.yml": {
        "parser": "yaml",
        "find": {
            "bind.ip": "0.0.0.0",
            "bind.port": "{{server.build.default.port}}"
       }
    }
}

to an empty object, the configured keys in settings.yml stay the same, which solves the problem.

While this solution works, the binding port is not automatically updated after install, and need to be changed manually.

gOOvER commented 2 years ago

i think, this is not really a panel issue, when an plugin dont work correct

DaneEveritt commented 2 years ago

This is probably similar to the other issues we have with YML files where the parser sometimes turns numbers into scientific notation. @parkervcp can probably confirm, but that is what this looks like. y/n/true/false are all the same in YML and it gets messy.

parkervcp commented 2 years ago

@DaneEveritt This looks like it's updating the keys which it shouldn't be doing. The issues we are normally seeing are when it updates values.

This is a significantly worse bug.

DaneEveritt commented 2 years ago

Either way its an issue with the library, I can see if there are tweaks but I'm not holding out much hope.

YAML is a disaster.

parkervcp commented 2 years ago

I can look into the yaml encoding. I have played around in it enough.

parkervcp commented 2 years ago

My guess is that it's here - https://github.com/pterodactyl/wings/blob/develop/parser/helpers.go#L100

Even though it's a key it's a value under the top level key and that may be the cause.

parkervcp commented 2 years ago

Poking around a bit more I have narrowed it down to the unmarshal from the yaml package.

https://github.com/pterodactyl/wings/blob/develop/parser/parser.go#L421

The way we are parsing it is with the map[string]interface{} where the string spawnPosition.y is getting parsed as spawnPosition."true"

The interface is parsing the y as a boolean even though it's a string.

parkervcp commented 2 years ago

Upgrading to gopkg.in/yaml.v3 appears to fix this.