Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[Runtime] Support Dotenv extra paths #60116

Closed
Labels
@natepage

Description

@natepage

Description

The Runtime component currently supports a seamless integration with the Dotenv component, and even allow to control its behaviour via runtime options within theSymfonyRuntime.

The current implementation accepts a single path, and uses it to boot the environment usingDotenv::bootEnv().
It would be great if we could extend this logic to support extra paths so applications could use multiple env vars files without having to handle the logic themselves.

The Dotenv component already support extra paths via the following functions:

  • public function load(string $path, string ...$extraPaths): void
  • public function overload(string $path, string ...$extraPaths): void

The idea here would be to add a newdotenv_extra_paths runtime option so the runtime could use it, keeping in mind the existingdotenv_overload option to call eitherload oroverload with those extra paths.

Our current use-case is to support region specific env vars files so we could have the following:

  • envs/dev.env
  • envs/dev-ap-southeast-2.env

Note that our use-case also incorporate custom path for the env vars files, but the extra paths solution discussed here would work independently.

Happy to work on a PR if the idea is acceptable

Example

$_SERVER['APP_RUNTIME_OPTIONS'] = ['dotenv_path' =>\sprintf('envs/%s.env',$_SERVER['APP_ENV'] ??'local'),'dotenv_extra_paths' => [\sprintf('envs/%s-%s.env',$_SERVER['APP_ENV'] ??'local',$_SERVER['AWS_REGION']),    ],'dotenv_overload' =>true,];

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp