I am developing a grails application. I want to externalize certain configuration values, so they can be specified on server startup.
In development I run the application using the following command to run the application
grails prod run-app -Dmy.property="secret"
At runtime I want to read the value in my controller using the following code
String myVal= System.getProperty("my.property")
When I check the value of myVal it is always null. I just want to be able to read the value of my.value consistently, pointers appreciated.
Note: I do not want to store values in Config.groovy. I have also tried System.getenv().get("my.property"), but that does not work either.
I have also referred to Externalizing Grails Datasource configuration.