panel icon indicating copy to clipboard operation
panel copied to clipboard

YAML Configuration Files are broken when starting the server

Open Lenni0451 opened this issue 2 years ago • 0 comments

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?

  • [X] I have searched the existing issues before opening this issue.
  • [X] I have provided all relevant details, including the specific game and Docker images I am using if this issue is related to running a server.
  • [X] I have checked in the Discord server and believe this is a bug with the software, and not a configuration issue with my specific system.

Lenni0451 avatar Jul 06 '22 18:07 Lenni0451

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

PoQuatre avatar Aug 12 '22 10:08 PoQuatre

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.

PoQuatre avatar Aug 12 '22 14:08 PoQuatre

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

gOOvER avatar Aug 12 '22 14:08 gOOvER

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.

DaneEveritt avatar Aug 12 '22 15:08 DaneEveritt

@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.

parkervcp avatar Aug 12 '22 15:08 parkervcp

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.

DaneEveritt avatar Aug 12 '22 16:08 DaneEveritt

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

parkervcp avatar Aug 12 '22 16:08 parkervcp

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 avatar Aug 12 '22 23:08 parkervcp

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 avatar Sep 13 '22 15:09 parkervcp

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

parkervcp avatar Sep 13 '22 15:09 parkervcp