1

I am trying to read the database password from Vault so that it is not visible in Environment variables in grails 3. Previously we were reading all database configs from environment variables in application.groovy like below;

dataSource {
pooled = true
dbCreate = "update"
url = System.getenv("DB_URL")
driverClassName = System.getenv("DB_DRIVER")
dialect = System.getenv("DB_DIALECT")
username = System.getenv("DB_USER")
password = System.etenv("DB_PASSWORD")
}

Now I have a service that reads database password from Vault secret but I am unable to call that service function from application.groovy since it a config file. What is the right way to do it?

Sikander
  • 834
  • 2
  • 10
  • 33

1 Answers1

0

you put it in runtime.groovy

def vault = new Vault()
url = vault.secret("secretKey")
Kamèl Romdhani
  • 342
  • 1
  • 9