Commit 36f81a1f authored by Exbrayat Cédric's avatar Exbrayat Cédric
Browse files

chore: spring cloud client config

Fixes #12
parent 59f04eff
......@@ -287,3 +287,25 @@ curl -X POST "localhost:9200/_aliases" -H 'Content-Type: application/json' -d'
}
'
```
## Spring Cloud config
On bootstrap, the application will try to connect to a remote Spring Cloud config server
to fetch its configuration.
The details of this remote server are filled in the `bootstrap.yml` file.
By default, it tries to connect to the remote server on http://localhost:8888
but it can of course be changed, or even configured via the `SPRING_CONFIG_URI` environment variable.
It will try to fetch the configuration for the application name `rare`, and the default profile.
If such a configuration is not found, it will then fallback to the local `application.yml` properties.
To avoid running the Spring Cloud config server every time when developing the application,
all the properties are still available in `application.yml` even if they are configured on the remote Spring Cloud server as well.
If you want to use the Spring Cloud config app locally,
see https://forgemia.inra.fr/urgi-is/data-discovery-config
The configuration is currently only read on startup,
meaning the application has to be reboot if the configuration is changed on the Spring Cloud server.
For a dynamic reload without restarting the application,
see http://cloud.spring.io/spring-cloud-static/Finchley.SR1/single/spring-cloud.html#refresh-scope
to check what has to be changed.
......@@ -16,9 +16,9 @@ plugins {
id("org.springframework.boot") version "2.0.4.RELEASE"
id("com.gorylenko.gradle-git-properties") version "1.4.21"
id("org.asciidoctor.convert") version "1.5.3"
id("io.spring.dependency-management") version "1.0.6.RELEASE"
}
apply(plugin = "io.spring.dependency-management")
java {
sourceCompatibility = JavaVersion.VERSION_1_8
......@@ -84,12 +84,17 @@ tasks {
}
}
dependencyManagement {
imports {
mavenBom("org.springframework.cloud:spring-cloud-dependencies:Finchley.SR1")
}
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.cloud:spring-cloud-starter-config")
implementation("org.springframework.data:spring-data-commons:2.1.0.RC1")
implementation("org.springframework.data:spring-data-elasticsearch:3.1.0.RC1")
implementation("org.elasticsearch:elasticsearch:6.3.1")
......
spring:
application:
name: rare
cloud:
config:
uri: ${SPRING_CONFIG_URI:http://localhost:8888}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment