Search code examples
javagroovymicronaut

Access environment variable in application.yml in a micronaut app


I have a token in my server, stored in an environment variable called TOKEN_URL

I want to access this variable in the Micronaut's configuration yml like this:

bot:
  token:
    value: ${env.TOKEN_URL}

Is there a way to access my env in this file? (${env.TOKEN_URL} is NOT working).


Solution

  • Have you tried just ${TOKEN_URL}?

    For the documentation on this, check out the "Property value binding" section of the micronaut docs.