0

What is Developed:

  1. Springboot Restful webservice App is deployed to Pivotal Cloud Foundry.

  2. Config server connects to Github and loaded all the property files.

  3. Springboot App connects to Config Server to read the properties.

  4. Springboot App will be accessed from Dev, INT and QA environments

My Question:

Example App: https://spring-boot-webservice-app.example.com/app is running on cloud

Config Server has three different property files like dev.properties, int.properties and qa.properties. Example app running on cloud https://spring-boot-webservice-app.example.com/app

Requests: 1. https://spring-boot-webservice-app.example.com/app/dev/get - read dev.properties 2. https://spring-boot-webservice-app.example.com/app/int/get- read int.properties 3. https://spring-boot-webservice-app.example.com/app/qa/get- read qa.properties

Same app will be called from dev, int and qa environments, So how will the spring boot webservice app know from which environment is the request coming from so that the app will read the correct properties for that environment without restarting or re-deploying the App?

IMNash
  • 25
  • 1
  • 1
  • 9
  • Please re-phrase your question and provide some more information. What do you mean exactly by `Same app will be called from dev, int and qa environments`. What are those environments? Your question is way too broad to be answered unless more information can be provided. – akortex Jun 22 '18 at 20:12
  • Same App in the sense the Spring boot App running on Cloud. Dev, INT, QA are different testing Environments. – IMNash Jun 22 '18 at 20:17
  • Yes I get that. What are the various environments? Another app? Someone's browser? – akortex Jun 22 '18 at 20:18
  • Yes different browsers – IMNash Jun 22 '18 at 20:20
  • Given a specific origin for the request, I suppose that you could filter out the request and check for the originating IP but this approach is very flimsy and shady in it's nature. The million dollar question here is why would you want to do this in the first place instead of having three distinct environments and just use profiles to do it. You have to note that property re-configuration may be hard to achieve especially if the latter one has been injected somewhere. I would suggest to re-think your approach on this one. – akortex Jun 22 '18 at 20:26
  • You mean put all the environment profiles in YAML files and load it in int method when the App starts? – IMNash Jun 22 '18 at 20:29
  • Let Me Phrase this differently. – IMNash Jun 22 '18 at 20:41
  • As stated above you can filter the request and retrieve the appropriate configuration. Since you're URI contain the environment (qa, int, test) just grab that. – akortex Jun 22 '18 at 20:58
  • makes sense....Thanks for the response – IMNash Jun 22 '18 at 20:59
  • An interceptor or a filter would do the job. You can also try an Aspect if you're familiar with those. – akortex Jun 22 '18 at 21:00
  • Take a look at the [Routes and Domains](https://docs.cloudfoundry.org/devguide/deploy-apps/routes-domains.html). It will allow you to have a specific url for dev / int / qa. And you can use filter to identify the origin of the request – K.AJ Jun 29 '18 at 14:07

0 Answers0