recipes icon indicating copy to clipboard operation
recipes copied to clipboard

Use "resolve" processor for MAILER_DSN env variable

Open leonboot opened this issue 1 year ago • 2 comments

Q A
License MIT

For the Doctrine bundle, the DATABASE_URL variable is processed by the resolve env var processor. This is nice, since the value can be read from file by using the file processor when defining its value, for instance. It would be nice if this would be applied to the MAILER_DSN for the Symfony Mailer as well, for the same reasons.

leonboot avatar Feb 16 '24 07:02 leonboot

Thanks for the PR 😍

How to test these changes in your application

  1. Define the SYMFONY_ENDPOINT environment variable:

    # On Unix-like (BSD, Linux and macOS)
    export SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes/flex/pull-1294/index.json
    # On Windows
    SET SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes/flex/pull-1294/index.json
    
  2. Install the package(s) related to this recipe:

    composer req 'symfony/flex:^1.16'
    composer req 'symfony/mailer:^4.3'
    
  3. Don't forget to unset the SYMFONY_ENDPOINT environment variable when done:

    # On Unix-like (BSD, Linux and macOS)
    unset SYMFONY_ENDPOINT
    # On Windows
    SET SYMFONY_ENDPOINT=
    

Diff between recipe versions

In order to help with the review stage, I'm in charge of computing the diff between the various versions of patched recipes. I'm going keep this comment up to date with any updates of the attached patch.

github-actions[bot] avatar Feb 16 '24 07:02 github-actions[bot]

It seems the "Run updated recipes" job fails because the package version to install is distilled from the modified files of the PR, but symfony/mailer:^4.3 can't be installed because of its dependency on symfony/event-dispatcher.

Offering an updated PR by creating a 5.0 version of the recipe will probably still break the v6 test. And the change provided in this PR will still work for Symfony 4 as far as I can tell, since the resolve processor is already available there.

leonboot avatar Feb 16 '24 08:02 leonboot

Hi, I'm not sure I understand the motivation for this change. What's the relation to the file processor?

nicolas-grekas avatar Mar 27 '24 09:03 nicolas-grekas

Closing as there is no more feedback.

fabpot avatar May 08 '24 14:05 fabpot

Looking at the documentation again, this may have been a result of misinterpretation on my part. I believed the resolve: env var processor would allow for using other env var processors in the env var's value (like file:DATABASE_URL_FILE, for instance). But looking at the docs, the resolve processor only resolved %variable% notations.

leonboot avatar May 15 '24 07:05 leonboot