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.81k stars 1.74k forks source link

Configuration parser json convert boolean to int #4462

Closed Thesam1798 closed 6 months ago

Thesam1798 commented 2 years ago

Current Behavior

Currently, in the Configuration Files of the nest, if the json parser is assigned and the environment variable is set to boolean, it puts 0 or 1 in the json file.

image

image

image

Expected Behavior

If the environment variable is boolean, it should put true or false in the json file.

Steps to Reproduce

Create an environment variable QUERY_PORT_ENABLED in boolean. Set the value to true. Define in Configuration Files of the nest a json parser like this:

{
    "config.json": {
        "parser": "json",
        "find": {
            "a2sQueryEnabled": "{{server.build.env.QUERY_PORT_ENABLED}}"
        }
    }
}

Create a server and check the config.json file

Panel Version

1.10.4

Wings Version

1.7.2

Games and/or Eggs Affected

All

Docker Image

All

Error Logs

All pterodactyl run in docker.

Wings logs : https://ptero.co/desalusowi.yaml
Panel logs : https://ptero.co/juxyqucihu.apache

Is there an existing issue for this?

parkervcp commented 2 years ago

This is a problem with laravel. Technically 0 and 1 are valid boolean values.

Many of my eggs use the following for bool values. "required|string|in:true,false"

Thesam1798 commented 2 years ago

I tried that, but the parser puts it in string and not in boolean in the json.

By the way, it does the same thing with strings that have only numbers, it converts to int...

Sam-fr commented 11 months ago

I also have this problem. Also with decimal numbers that become strings.

It might be a good idea to be able to specify a value type to the parser, something like this:

{
    "config.json": {
        "parser": "json",
        "find": {
            "a2sQueryEnabled": "{{server.build.env.QUERY_PORT_ENABLED;boolean}}"
        }
    }
}
hafometh88 commented 4 months ago

Still no way around this?