Skip to content

Instantly share code, notes, and snippets.

@emrekgn
Last active June 25, 2023 23:55
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save emrekgn/93fab341cbe29ea54e866e51001a5f5c to your computer and use it in GitHub Desktop.
Save emrekgn/93fab341cbe29ea54e866e51001a5f5c to your computer and use it in GitHub Desktop.
Spring Cloud Config Server and Client example configuration
# application.yml file of the config server (Spring Cloud Config Server)
server:
port: 9999 # or whatever
spring:
application:
name: config-service
cloud:
config:
server:
git:
#uri: file:///path/to/your/config/dir
uri: git@github.com:foo/bar.git
# This allows us to use client service names (i.e. application names) as sub-directories in the config repository. See below example.
search-paths: '{application}'
clone-on-start: true
delete-untracked-branches: true
ignore-local-ssh-settings: false
refresh-rate: 300
# application.yml file of the client service (Spring Cloud Config Client)
spring:
application:
name: client-service
config:
import: configserver:http://localhost:9999
cloud:
config:
fail-fast: true
# An example of directory structure of a config repository:
.
├── application-dev.yml
├── application-prod.yml
├── application.yml
├── client-service
│   └── application.yml
│   └── application-anotherprofile.yml
├── another-client-service
   └── application.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment