10000 Add a way to resolve environment variables in debug:config · Issue #40582 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Add a way to resolve environment variables in debug:config #40582

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

Closed
melkamar opened this issue Mar 25, 2021 · 7 comments · Fixed by #46821
Closed

Add a way to resolve environment variables in debug:config #40582

melkamar opened this issue Mar 25, 2021 · 7 comments · Fixed by #46821

Comments

@melkamar
Copy link
melkamar commented Mar 25, 2021

Description

The bin/console debug:config does not attempt to resolve environment variables (at least in 5.1.11) which makes it difficult to verify that expected values are being passed around.

I don't know if this change may be introduced without any BC breaks but if not, even having the option, like --resolve-env would be nice for situations where I know I want that behavior.

Current behavior

$ bin/console debug:config swiftmailer

Current configuration for extension with alias "swiftmailer"
============================================================

swiftmailer:
    mailers:
        default:
            transport: '%env(string:default:mailer_default_transport:MAILER_TRANSPORT)%'
            host: '%env(string:default:mailer_default_host:MAILER_HOST)%'
            username: '%env(string:default:mailer_default_username:MAILER_USERNAME)%'
            password: '%env(string:default:mailer_default_password:MAILER_PASSWORD)%'
    (...)

Proposed behavior

$ bin/console debug:config swiftmailer

Current configuration for extension with alias "swiftmailer"
============================================================

swiftmailer:
    mailers:
        default:
            transport: 'actual value or error if not resolvable'
            host: 'actual value or error if not resolvable'
            username: 'actual value or error if not resolvable'
            password: 'actual value or error if not resolvable'
    (...)

I did not find an opened issue about this particular problem, just some related ones, such as #20684 (comment)

@stof
Copy link
Member
stof commented Mar 25, 2021

which version of Symfony are you using ?

@melkamar
Copy link
Author

Sorry, I left that one out. Using 5.1.11

@alexandre-daubois
Copy link
Member

Hi!
Gave it a try in #40688, works well without any BC.

@carsonbot
Copy link

Thank you for this suggestion.
There has not been a lot of activity here for a while. Would you still like to see this feature?

@bigfoot90
Copy link

Yes, I'm interested

@carsonbot carsonbot removed the Stalled label Oct 3, 2021
@carsonbot
Copy link

Thank you for this suggestion.
There has not been a lot of activity here for a while. Would you still like to see this feature?

@alexandre-daubois
Copy link
Member

I'll start this again, still interested in doing it! 👍

@carsonbot carsonbot removed the Stalled label Apr 8, 2022
@fabpot fabpot closed this as completed Jul 21, 2022
fabpot added a commit that referenced this issue Jul 21, 2022
…nfig command (alexandre-daubois)

This PR was merged into the 6.2 branch.

Discussion
----------

[FrameworkBundle] Add `resolve-env` option to debug:config command

| Q             | A
| ------------- | ---
| Branch?       | 6.2
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #40582
| License       | MIT
| Doc PR        | _NA_

Add `--resolve-env` option to `debug:config` command to display actual values of environment variables in dumped configuration.

This main purpose of this command is debugging as its name suggests. In order to help the developer to debug its configuration, it is convenient to display the actual value of environment variables present in the dumped configuration, instead of placeholders.

Here is the result:

```
$ symfony console debug:config framework | grep secret
    secret: '%env(APP_SECRET)%'
    secrets:
        vault_directory: '/home/alexandredaubois/(...)/config/secrets/%env(default:kernel.environment:APP_RUNTIME_ENV)%'

$ symfony console debug:config framework --resolve-env | grep secret
    secret: 90d83502629d64dec4cd6e33c9b31267
    secrets:
        vault_directory: /home/alexandredaubois/(...)/config/secrets/dev
```

Commits
-------

bdc8e02 [FrameworkBundle] Add `resolve-env` option to debug:config command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
0