8000 Using environment variables at compile time · Issue #25173 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Using environment variables at compile time #25173
Closed
@mathroc

Description

@mathroc
Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? no
Symfony version 3.3.x

Environement variables can be used to configure the application at runtime, but it’s not easy to distinguish that from compile time configuration, this has recently improved thanks to @nicolas-grekas with #25163. there is now a message like that :

Incompatible use of dynamic environment variables "FOOBAR" found in parameters.

But I think it should be possible to use env var, probably by explicitly marking it as "compiled", eg:

framework:
    translator:
        paths:
            - "%kernel.project_dir%/src//Resources/translations/%compile:env(SITE_IDENTIFIER)%"

this syntaxe also allows to compile a parameter, in case it’s value comes from an env var:

parameters:
    site_identifier: %env(SITE_IDENTIFIER)
framework:
    translator:
        paths:
            - "%kernel.project_dir%/src//Resources/translations/%compile:site_identifier%"

I don’t know yet how hard it is to implement but I’d like to take a look at it. however I’d first like to gather your input on this. I think it would nicely bridge env vars use between compile time and runtime configuration

see #24270 & #24368

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

      0