Multiple search-paths for config server in Spring boot

4k Views Asked by At

I need to create a dedicated config server for a list of microservices. Following is the snippet of application.yml of the config server:

server.port: 8888
management.security.enabled: false

spring:
  cloud:
    config:
      server:
        git:
          uri: some github link
          username: ENC(/YNsVqtbBwIOq+KlzzQrn6WZbg1tPxzn9V0BM=)
          password: ENC(+jatkfs906vfPwqPxtkgBn3LeVGr)
          search-paths:
            - microcervices1
            - microservices2
            - microservices3

jasypt:
  encryptor:
    algorithm: some algorithm
    password: Its password

I am facing problem in accessing those microservices configurations.

The documentation http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html#_spring_cloud_config_server mentions that wildcards {application}, {label}, {profile} can be used within the searchPaths variable so that "you can segregate the directories in the path"

It Would be a great help If anyone can help me out with this issue, Thanks!

1

There are 1 best solutions below

0
On

It can be solved as following :

Suppose you have in your config repo properties for multimple services organized in folders: properties organized in folders

Then, your config file for config server looks like this :

server:
  port: 8888
spring:
  cloud:
    config:
      server:
        git:
          uri:[git repo]
          search-paths:
           - billing-service
           - shipping-service

This way you can organize all the properties in one central config repository and tell spring config server in which folders to look for properties