I'm trying to have application.yaml
file in go application which contains ${RMQ_HOST}
values which I want to override with environment variables.
In application.yaml
I've got:
rmq:
test:
host: ${RMQ_HOST}
port: ${RMQ_PORT}
And in my loader I have:
log.Println("Loading config...")
viper.SetConfigName("application")
viper.SetConfigType("yaml")
viper.AddConfigPath(".")
viper.AutomaticEnv()
err := viper.ReadInConfig()
The problem I have is ${RMQ_HOST}
won't get replaced by the values I've set in my environment variables, and tries to connect to the RabbitMQ with this string
amqp://test:test@${RMQ_HOST}:${RMQ_PORT}/test
instead of
amqp://test:test@test:test/test