Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple search-paths for config server in Spring boot

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!

like image 242
Vipin Makde Avatar asked Mar 08 '26 12:03

Vipin Makde


1 Answers

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

like image 179
Ion Scorobogaci Avatar answered Mar 12 '26 16:03

Ion Scorobogaci



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!