-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Incorrect type-cast for boolean config values #22343
Labels
Comments
Thanks! My bad, I did not see that one! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the Bug
For config options there is an automatic type-casting (https://docs.directus.io/self-hosted/config-options.html#type-casting-and-nesting). In the code, the relevant parts are in the env package
lib/cast.ts
andutils/guess-type.ts
.When using an actual boolean value in the config options, the parsed value turns into
0
instead offalse
or1
instead oftrue
.I believe that this issue is there since version v10.9.0 when the env package was introduced.
To Reproduce
Add an option with the type boolean to the
config.json
, e.g."MY_VARIABLE": false
.Retrieve the parsed value via:
The current work-around is to define the option as a string
"MY_VARIABLE": "false"
(returnsfalse
in the application).Also, here are two test cases for
guess-type.test.ts
that currently fail due to the issue:Directus Version
v10.10.7
Hosting Strategy
Self-Hosted (Docker Image)
The text was updated successfully, but these errors were encountered: