Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

env processing and DI problem in monolog mailer config with multiple addresses #39499

Closed
mmarton opened this issue Dec 14, 2020 · 5 comments
Closed

Comments

@mmarton
Copy link

mmarton commented Dec 14, 2020

Hi!

Symfony version(s) affected: 5.2

Description
I'd like to set multiple to addresses to monolog email handler from env config.
I have the following monolog configuration:

monolog:
    handlers:
        email:
            type: fingers_crossed
            action_level: critical
            handler: deduplicated
        deduplicated:
            type: deduplication
            handler: symfony_mailer
        symfony_mailer:
            type: symfony_mailer
            content_type: text/html
            from_email: 'from@email.com'
            to_email: '%env(json:EXCEPTION_EMAIL_ADDRESSES)%'
            subject: 'Exception %%message%%'
            level: debug
            formatter: monolog.formatter.html

and env file with:
EXCEPTION_EMAIL_ADDRESSES='["address1@email.com","address2@email.com"]'

problem:
the config normalizer runs before the env processing here
https://github.com/symfony/monolog-bundle/blob/master/DependencyInjection/Configuration.php#L610
and sees my to_email as a string: string(79) "env_777f8e4b1e96b241_EXCEPTION_EMAIL_ADDRESSES_1787d55fa4dbd016b8b6bb36ab5f3002"
and wraps it into an array

passing an array of email directly to the config works as expected:
to_email: ["address1@email.com","address2@email.com"]

@mmarton mmarton added the Bug label Dec 14, 2020
@mmarton mmarton changed the title multiple env processing and DI problem in monolog mailer config env processing and DI problem in monolog mailer config qith multiple addresses Dec 14, 2020
@mmarton mmarton changed the title env processing and DI problem in monolog mailer config qith multiple addresses env processing and DI problem in monolog mailer config with multiple addresses Dec 14, 2020
@carsonbot
Copy link

Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?

@mmarton
Copy link
Author

mmarton commented Jun 17, 2021

Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?

No, it is still an issue, I figured out it is based on variable resolving: #40794

@carsonbot
Copy link

Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?

@carsonbot
Copy link

Could I get a reply or should I close this?

@mmarton
Copy link
Author

mmarton commented Jan 2, 2022

closing in favor of #40794

@mmarton mmarton closed this as completed Jan 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants