Using the Grails RabbitMQ-native plugin, when using environment variable interpolation in the configuration of the Rabbit connection in the application.yml, the interpolation doesn't work:
rabbitmq:
connections:
- name: defaultConnection
host: example.com
username: ${RABBITMQ_USER}
password: bar
Leads to an AuthenticationFailureException while hardcoding the same credentials work.
Is there a workaround? I don't want to hardcode the credentials to our RabbitMQ instance...
A workaround is to define the rabbitMQ connections in the application.groovy file.
Example:
// Rabbitmq connection configuration
rabbitmq {
connections = [
[
name: "main",
host: System.getenv('RABBITMQ_HOST'),
username: System.getenv('RABBITMQ_USER'),
password: System.getenv('RABBITMQ_PASS')
]
]
}