Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Cloud Config Server Shared Properties Across Applications

I currently have a number of deployable applications that work in a distributed fashion to solve a business problem. We are currently using a number of property configuration files to provide changing configuration per environment based off a system environment variable. All these deployable application share common configuration for database and messaging. This is currently achieved by picking up property files from the class path and having both deployed apps share a common jar for each connection (db, jms) containing property files.

I am looking to start using Spring Config Server to externalize this configuration if possible. I have a question about how to share this common config.

Currently it looks something like this:-

Web1
- database
- jms

Messaging1
- database
- jms

In this situation both deployed apps share the same connections and these connections change per environment (lab, prf, prd, etc). How can I achieve the same with the Spring Configuration Server where I have app config for each deployable app?

Application.yml
Web1.yml
Web1-dev.yml
Messaging1.yml
Messaging1-dev.yml

If a connection property changed for an environment I would need to make the change to each deployable app configuration rather than making it just once.

Is there currently anyway to achieve this? Am I just missing a simple point?

like image 559
Jeffxor Avatar asked Apr 21 '15 20:04

Jeffxor


People also ask

How does spring cloud Config server work?

Spring Cloud Config is Spring's client/server approach for storing and serving distributed configurations across multiple applications and environments. This configuration store is ideally versioned under Git version control and can be modified at application runtime.


1 Answers

I found working solution here https://cloud.spring.io/spring-cloud-config/single/spring-cloud-config.html, paragraph "2.1.5 Sharing Configuration With All Applications". It says:

With file-based (i.e. git, svn and native) repositories, resources with file names in application* are shared between all client applications (so application.properties, application.yml, application-*.properties etc.). You can use resources with these file names to configure global defaults and have them overridden by application-specific files as necessary.

You should create application.properties or application.yml at the top level of configuration repository (if it is git or svn based). Don't forget to commit the changes.

like image 73
Wojciech Wirzbicki Avatar answered Oct 13 '22 12:10

Wojciech Wirzbicki