Unable to use environment variable for settings
Closed this issue · 4 comments
zeleznypa commented
We need to get RabbitMQ host, port, etc. from environment variables
in neon we have:
extensions:
rabbitmq: Kdyby\RabbitMq\DI\RabbitMqExtension
rabbitmq:
connection:
host: ::getenv(RABBITMQ_HOST)
port: ::getenv(RABBITMQ_PORT)
user: ::getenv(RABBITMQ_USER)
password: ::getenv(RABBITMQ_PASSWORD)
But we give an assertion error that callback is not a valid string because of this
fprochazka commented
I don't think I wanna support this. You can do something like
<?php
return [
'rabbitmq' => [
'connection' => [
'host' => getenv('RABBITMQ_HOST'),
]
]
];
and then register it in config
includes:
- rabbitmq.php
or use one of hundreds other ways to pass the ENV variable to the section.
zeleznypa commented
Thanks for tip, how to include environment variables other way.
I just tried it "DG preferred way"
Unfortunately it is just because the validation of user and password. Whole other code fully support this way. I think, it will be more transparent, when whole configuration will be in one *.neon. file instead of including the PHP code.
fprochazka commented
zeleznypa commented
Thanks Filip