Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Typed env var and allow nullable #28618

Copy link
Copy link
Closed
@steevanb

Description

@steevanb
Issue body actions

Description
For now, DotEnv component don't allow null as value and don't type values.
We can type value when reading, with %env(int:foo)%. But if an env var is used more than one time, we have to duplicate type hint at each read.

Can we take that problem (typing at reading) on the other side: typing at declaration, not at reading ?

For null value, it's impossible for now, and that's a problem. Maybe we can have a syntax to allow null at declaration ?

Example
/.env
VAR_INT=!int:12
VAR_FLOAT=!float:12.2
VAR_STRING=!string:foo
VAR_STRING_2=foo
VAR_ALLOW_NULL=!?string:null
VAR_ARRAY=!array:[!int:12, !string:foo]

Problems

As DotEnv is installed for dev env by default, how can we do to parse env var in prod env ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.