Application name in manifest.yml is overriding spring:application:name in appsettings.json
See original GitHub issueTo support Blue/Green deployments we apply a version number suffix on the application name in the manifest.yml
when pushing to PCF:
---
applications:
- name: appname-v1-0-1
path: ./bin/linux-x64
memory: 256MB
stack: cflinuxfs3
buildpacks:
- dotnet_core_buildpack
instances: 1
env:
ASPNETCORE_ENVIRONMENT: sandbox
services:
- config-server
We do not apply a version number suffix on the application name in appsettings.json
:
{
"spring": {
"application": {
"name": "appname"
}
}
}
We have a yml configuration file called {application}-{environment}.yml
(e.g. appname-sandbox.yml
).
The issue is that the name of the application in manifest.yml
/ VCAP_APPLICATION
is being used rather than the application name in appsettings.json
, by the Steeltoe Configuration libraries, when attempting to locate a yml configuration file.
We have also attempted to explicitly set the application name in code via the Steeltoe.Extensions.Configuration.ConfigServer.ConfigServerConfigurationBuilderExtensions.AddConfigServer(environment, ApplicationName, LogFactory)
extension method, but the application name is not propagated properly. The application name from the manifest.yml
is still being used.
This behavior seems to be inconsistent with Java Spring Boot.
This looks to be the same, or very similar, to the issue reported at: https://github.com/SteeltoeOSS/Configuration/issues/37
In that same issue it was stated:
I believe the problem you were having with this was that spring.application.name was always being overridden by the name in the manifest.yml when you pushed the app to PCF. This Steeltoe behavior was not consistent with Java Spring Boot applications.
With Java based apps, if you DID NOT configure spring.application.name, then s.a.n would be set to the application name from manifest.yml. If you DID configure s.a.n, then it would be left alone and remain as configured.
With Steeltoe 2.2, to be released by end of 1st Qtr, we no longer override s.a.n when pushing to PCF (i.e. we follow what Java Spring Boot does).
Any idea when this will be fixed?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:11 (5 by maintainers)
Top GitHub Comments
This is a serious problem for real production scenarios.
With this change, spring:application:name will no longer be set/overriden by the Steeltoe libraries. Config Server client will use the following name(s), in the following order, when retrieving configuration values from a server:
spring:cloud:config:name
if foundspring:application:name
if foundvcap:application:name
if found (typically provided by Steeltoe CloudFoundry configuration provider) 4:IHostingEnvironment.ApplicationName
as default