question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Application name in manifest.yml is overriding spring:application:name in appsettings.json

See original GitHub issue

To 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:closed
  • Created 4 years ago
  • Reactions:8
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

13reactions
stuwilliams-clgxcommented, May 21, 2019

This is a serious problem for real production scenarios.

0reactions
dtillmancommented, Jun 18, 2019

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:

  1. spring:cloud:config:name if found
  2. spring:application:name if found
  3. vcap:application:name if found (typically provided by Steeltoe CloudFoundry configuration provider) 4: IHostingEnvironment.ApplicationName as default
Read more comments on GitHub >

github_iconTop Results From Across the Web

Application name in manifest.yml is overriding spring ...
We have a yml configuration file called {application}-{environment}.yml (e.g. appname-sandbox.yml ). The issue is that the name of the ...
Read more >
How to overwrite application name specified in appsettings ...
@PavelAnikhouski Serilog.Settings.Configuration is available from .NET 4.6.1. I've added the code which I'm using to load the appsettings.json.
Read more >
54. Properties & configuration
YAML is a superset of JSON and as such is a very convenient syntax for storing external properties in a hierarchical format. E.g....
Read more >
Enabling .NET Core Microservices with Steeltoe and ...
I have already created a Git repository and pushed my settings there. There is a convention and spring.application.name specified in app.
Read more >
Spring Cloud Services for Pivotal Cloud Foundry
SERVER is the URL from credentials.uri as mentioned in Step 1, APPLICATION_NAME is the application name as set in the spring.application.name property, and ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found