Reputation: 1
I have bound my application to config server. It is able to pull properties from cloud.yml files but it is not using properties from env specific yml files like {my-app}-{profile(dev/test)}.yml
.
When the application is deployed to a specific env, it should use properties from both cloud and test specific files.
manifest.yml
applications:
- name: abc
services:
- config-server-dev
- SERVICE_REGISTRY
env:
SPRING_PROFILES_ACTIVE: cloud, dev
We have git repository for config files. We have for example cloud.yml
and {my-app}-{profile(dev/test)}.yml
... files. Common properties are defined in cloud.yml
and env specific in {my-app}-dev.yml/{my-app}-test.yml/{my-app}-prod.yml
... We get the property parmas in the java files from these files.
@Value("${product.url}")
private String myproduct;
The problem is that the application is able to pull cloud.yml files but not env specific files.
PCF: in pcf we have option in settings to configure 'Spring Cloud Config Server' like below:
{
"git" : {
......
"baseDir" : "xxx",
"privateKey" : "xxx",
"sourceUri" : "git hub url for config repo",
"periodic" : true,
"ignoreLocalSshSettings" : true,
"defaultLabel" : "git hub branch name of config repo ",
"sourcePrivateKey" : "xxx",
"label" : "git hub branch name of config repo",
"uri" : "xxxxxx"
}
------
-------
}
PCF configuration will be bounding the git repo and spring cloud config server.
Application side: In the application, the manifest.yml
file mentions spring active profile as cloud and dev
Application.logStartupProfileInfo- The following 2 profiles are active: "cloud", "dev"
ConfigServerConfigDataLoader.log- Fetching config from server at : https://config-server-xxx-xxxtest.net
ConfigServerConfigDataLoader.logTo- Located environment: name=application, profiles=\[cloud,dev\], label=null, version=null, state=null
ConfigServerConfigDataLoader.logTo- Fetching config from server at : https://config-server-xxx-xxxtest.net
ConfigServerConfigDataLoader.logTo- Located environment: name=application, profiles=\[default\], label=null, version=null, state=null```
Upvotes: 0
Views: 21