Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[FrameworkBundle] lint:container should check if referenced env variables exist #58105

Closed
@ostrolucky

Description

@ostrolucky

Description

It's common mistake in our teams to define environment variable for one environment (eg. staging), but not the other (eg. production). Deploying such application with such configuration works and even most of the routes, but once one of the route needs service that requires the env var, at that point things blow up with this error

Noticed exception 'Symfony\Component\DependencyInjection\Exception\EnvNotFoundException' with message 'Environment variable not found: "PM_DC_TOKEN".' in /srv/api/vendor/symfony/dependency-injection/EnvVarProcessor.php:221

So I thought one neat way how I can avoid such issues in future is to add CI job which runs bin/console lint:container - both during CI run and during deployment, however this command does not complain about this. I'm wondering what else I can do?

symfony version I use: 7.1.3

Example

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions