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

Port cannot be configured by env var #207

Open
pvgnd opened this issue Jan 20, 2021 · 2 comments
Open

Port cannot be configured by env var #207

pvgnd opened this issue Jan 20, 2021 · 2 comments

Comments

@pvgnd
Copy link
Contributor

pvgnd commented Jan 20, 2021

As the ENV var is resolved at runtime, port is casted into int by the bundle configuration class: https://github.com/swarrot/SwarrotBundle/blob/master/DependencyInjection/Configuration.php#L90

Configuration used:

swarrot:
    connections:
        event:
          host: '%env(APP_MESSAGE_BROKER_HOST)%'
          port: '%env(APP_MESSAGE_BROKER_PORT)%'
          login: '%env(APP_MESSAGE_BROKER_LOGIN)%'
          password: '%env(APP_MESSAGE_BROKER_PASSWORD)%'
bash-5.0$ php bin/console debug:config swarrot

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

swarrot:
    connections:
        event:
            host: '%env(APP_MESSAGE_BROKER_HOST)%'
            port: 0
            login: '%env(APP_MESSAGE_BROKER_LOGIN)%'
            password: '%env(APP_MESSAGE_BROKER_PASSWORD)%'
@odolbeau
Copy link
Member

Hi @pvgnd and thanks or this bug report.
I strongly advise you to use the FQDN instead:

swarrot:
    connections:
        rabbitmq:
            url: "amqp://%rabbitmq_login%:%rabbitmq_password%@%rabbitmq_host%:%rabbitmq_port%/%rabbitmq_vhost%"

It will be easier to configure the FQDN per environment and you won't have this cast problem anymore.

I thought we depreciated the connection as array configuration when we introduced the FQDN configuration but it's not the case. :/

@pvgnd
Copy link
Contributor Author

pvgnd commented Jan 21, 2021

Good to know ! Thanks @odolbeau

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants