GoogleCloudPlatform / app-gradle-plugin

The library has moved to https://github.com/GoogleCloudPlatform/appengine-plugins/tree/main/app-gradle-plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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?

commented

Do you have an appengine-web.xml? or are you using only app.yaml?

I only use app.yaml. Is this the problem?

commented

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