How to set spring.profiles.active property dynamically for appengineDeploy task?
emmeblm opened this issue · comments
Hi,
My project uses profile specific properties by loading a yaml depending on the value of spring.profiles.active.
I know I can set this property in the app.yaml by declaring the env_variables JAVA_OPTS. The problem is that I need not to hardcode this value but instead, read it from another environment variable I set in the machine that is doing the deployment to app engine.
Is there a way to configure this property dynamically for my deployment?
Hi, any update on this?
Do you have an appengine-web.xml? or are you using only app.yaml?
I only use app.yaml. Is this the problem?
Actually no, that probably makes it easier to solve.
So what you can do is write a custom task to inject it into the app.yaml between appengineStage and appengineDeploy.
task myAppYamlInjector {
dolLast {
// some code here to replace tokens in a file?
ant.replace(file: "${buildDir}/staged-app/app.yaml", token: "placeholder", value: "replacement")
}
}
myAppYamlInjector.dependsOn appengineStage
appengineDeploy.dependsOn myAppYamlInjector
Closing as part of cleanup. Please re-open if it's still relevant