Spring Cloud Config - Multiple Composite Repositories?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Spring Cloud Config - Multiple Composite Repositories?



Is it possible configure Spring Cloud Config with multiple composite repositories? Our setup uses multiple team-based repositories:


spring:
cloud:
config:
server:
git:
repos:
teamA:
cloneOnStart: true
pattern: teama-*
searchPaths: 'profile'
uri: file:///etc/config/teama
teamB:
cloneOnStart: true
pattern: teamb-*
searchPaths: 'profile'
uri: file:///etc/config/teamb



We want each team to now pull from 2 different git repositories. I think multiple Composite repositories (https://cloud.spring.io/spring-cloud-config/single/spring-cloud-config.html#composite-environment-repositories) is what we want, but I can't figure out how to combine them, or if it is even possible.



Clarification:



I want each team to put configuration data from two repos instead of just the 1. In pseudo code:


spring:
cloud:
config:
server:
git:
repos:
teamA:
repo1:
key1: repo1
key2: repo1
repo2:
key1: repo2
key2: repo2




1 Answer
1



In this case your can use composite configuration. Next configuration is working for me, client service is using properties from 2 repositories


spring:
profiles:
active: composite
cloud:
config:
server:
composite:
-
type: git
cloneOnStart: true
uri: https://github.com/..../test-config
-
type: git
cloneOnStart: true
uri: https://github.com/..../test-config-2



You may need to configure 'searchPaths' for each for your needs. Profile should be composite (at least one of profiles)





I updated my question. I'd like each team to get info from 2 repos, if possible.
– BigTexasDork
Aug 8 at 13:06





Do you have team specific configuration for same projects in different repos and want to take it based on client profile ? Or you want just to use 2 git repos with different configurations for different projects ? What problem did you have during using composite configuration that you mentioned in the main question ?
– nmyk
Aug 8 at 14:53





The actual use case is this: each team manages their own repo, but we want to manage some common properties in a common repo across all teams. So we want teamA to read from teamA repo AND common repo.
– BigTexasDork
Aug 8 at 15:20





modified the response. this sample configuration is working for me (just tried). One repository contains some properties, another different properties for the same service. Service needs all if them to start. If properties are the same precedence is determined by order of appearance in configuration file
– nmyk
Aug 9 at 10:18





i'm just now getting back to this. in your test configuration above, what rest url did you hit to get values from both repos. i get only a 404, but acuator endpoints show the config loaded correctly, so i'm definitely doing something wrong.
– BigTexasDork
Aug 14 at 20:00






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard