Spring config server read proterties from local machine if fetch data from git repositories failed

881 Views Asked by At

I am new for spring config server. I want to implement spring config server from my application where my config server fetch properties details from git repositories but in case of my git server are not able to respond, how can I read properties from my local machine?

Note: I want to read properties from my local machine only in case my git server are not able to respond.

1

There are 1 best solutions below

0
On

You can do it with the following configurations by repository.

spring:
  cloud:
    config:
      server:
        git:
          uri: https://github.com/your-repository/config-repo
          repos:
            local:
              pattern: local*
              uri: file:/home/your-directory/config-repo
  1. local repository will match all application names beginning with local in all profiles.
  2. If was not matched your application names beginning with local in all profiles then by default URI spring.cloud.config.server.git.uri value will be replaced.

Here is documentation about it config-server-multiple-repositories.