BigTexasDork
BigTexasDork

Reputation: 216

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 pull 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

Upvotes: 1

Views: 3688

Answers (1)

nmyk
nmyk

Reputation: 1622

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)

Upvotes: 2

Related Questions