-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Symfony CLI] Docker integration and MailCatcher prefix #15424
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
Conversation
Hi 👋 Given my `docker-compose.yaml`: ```yaml version: '3.6' volumes: db-data: redis-data: services: database: image: 'mysql:5.7' ports: [3306] environment: MYSQL_USER: 'app' MYSQL_PASSWORD: 'app' MYSQL_DATABASE: 'app' MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' TZ: Etc/UTC volumes: - db-data:/var/lib/mysql - .manala/init-db:/docker-entrypoint-initdb.d healthcheck: test: mysqladmin ping --silent interval: 10s timeout: 5s retries: 5 phpmyadmin: image: phpmyadmin ports: [80] environment: PMA_HOST: 'database' PMA_USER: 'app' PMA_PASSWORD: 'app' redis: image: 'redis:alpine' ports: [6379] environment: TZ: Etc/UTC volumes: - redis-data:/data phpredisadmin: image: erikdubbelboer/phpredisadmin ports: [80] environment: REDIS_1_HOST: 'redis' mailcatcher: image: 'schickling/mailcatcher' ports: [1025, 1080] environment: TZ: Etc/UTC ``` When running `docker-compose up` and `symfony var:export --multiline`, the env vars for MailCatcher are prefixed (by default) by `MAILCATCHER_` but not by `MAILER_`.
If you rename your service to Kocal the will be prefixed with KOCAL_ |
@fabpot can you maybe help here? |
I'm merging this because in the changelog of v4.16.0 (from June 8, 2020) we can see this:
|
Thank you Hugo. |
Oh, so this was a special case for Mailer/Mailcatcher... Thanks for the investigation Javier! |
This must be reverted. The docs were right. There is nothing special with mailer. As discussed above, it depends on the name of the service. And by default, people should use |
The second column is the Symfony expected env var prefix. |
So it's the wording |
No, it’s correct |
But what this column provides as information? If env vars are prefixed by the docker service name (which is the case), we don't need to know what Symfony expects as prefix for env vars, right, since the user decides which env vars to inject to Symfony? Or am I missing something? EDIT: If in my foobar:
image: 'schickling/mailcatcher'
ports: [1025, 1080]
environment:
TZ: Etc/UTC This is what
And I can use the following code in framework:
mailer:
dsn: '%env(FOOBAR_DSN)%' So what's the point of this column? 😕 |
This PR was merged into the 4.4 branch. Discussion ---------- Revert the changes made in #15424 Reverts the changes made in #15424 because of #15424 (comment) Commits ------- b61d2a9 Revert the changes made in #15424
* 4.4: Revert the changes made in symfony#15424
* 5.3: Revert the changes made in symfony#15424
* 5.4: Revert the changes made in symfony#15424
It depends on what you think "Symfony" means in "Symfony default prefix", and I must admit that I also wrongly understood this up until now. It means "The Symfony Framework recipes expect these prefixes to be used by service", it doesn't mean "The Symfony CLI uses this prefix". E.g. if you look at the Symfony Flex mailer recipe, you'll see that |
I agree. I think we should drop the prefix column completely and only have the "Recommended Docker service name" column. Then, explain above/below this table that Symfony CLI uses the Docker container name as prefix (e.g. |
Re-reading the text above, I think everything is already well explained. |
Hi 👋
Given my
docker-compose.yaml
:When running

docker-compose up
andsymfony var:export --multiline
, the env vars for MailCatcher are prefixed (by default) byMAILCATCHER_
but not byMAILER_
: