swarrot / SwarrotBundle

A symfony bundle for swarrot integration
MIT License
89 stars 59 forks source link

1.6.0 Port mapping with variables #143

Open matthieuwerner opened 6 years ago

matthieuwerner commented 6 years ago

Hello :).

Something looks weird on the version 1.6.0 with the port mapping specifically when we are using environnement variable mapping.

In the yaml :

rabbitmq_port: '%env(int:RABBITMQ_PORT)%'

The value of 'port' index in this case is 0;

It looks like the parameter is processed and converted to string before being replaced by the environnement value.

Something in there is maybe wrong with "beforeNormalization" https://github.com/swarrot/SwarrotBundle/commit/c95a65e0b6ab678c68eaa2b1259f3f442bcf0a75

Best regards.

odolbeau commented 6 years ago

Hi @matthieuwerner & sorry for the late answer...

Could you please tell me which version of symfony you're using? Could you try to debug which is the string passed to the beforeNormalization method? I bet it's %env(int:RABBITMQ_PORT)%?

Last but not least, is everything working fine when using the url config key? (see Configuration reference)

I'll add some tests on this class and mark the "old style config" (not using url) as deprecated when I'll have those information.

B-Galati commented 5 years ago

@odolbeau Hello!

Using Symfony 4.2.1.

With int, I have:

"env_46199cc6221ede45_int_SYMFONY__YS__RABBITMQ__PORT_84a7d4ce68c4e237c3cad97f2b8ef136"
Configuration.php on line 123:
"env_46199cc6221ede45_int_SYMFONY__YS__RABBITMQ__PORT_84a7d4ce68c4e237c3cad97f2b8ef136"
Configuration.php on line 123:
"%env(int:SYMFONY__YS__RABBITMQ__PORT)%"

Without int, I have:

Configuration.php on line 123:
"env_3100f1e69d1a1b31_SYMFONY__YS__RABBITMQ__PORT_05cb34255f9c84d8f4c6d6a98669318c"
Configuration.php on line 123:
"env_3100f1e69d1a1b31_SYMFONY__YS__RABBITMQ__PORT_05cb34255f9c84d8f4c6d6a98669318c"
Configuration.php on line 123:
"%env(SYMFONY__YS__RABBITMQ__PORT)%"

It's working fine with url ;-)

odolbeau commented 5 years ago

Thanks for your feedback!

I really have to find some time to release a new minor version to deprecate those options... :/ Keep using the url anyway, that's the correct configuration. :+1: