I have a working Spring cloud config server who provides configuration from a git repository. All configurations are stored in the root directory in the repository. They are named {name}-{profile}.yml.
I have changed the directory structure to {name}/{profile}.yml
When I curl http://configserver:8888/appname/myprofile the config server I get a json response but the propertySources is empty.
My spring cloud server config
spring:
cloud:
config:
server:
git:
uri: http://git#git.host/scm/cas/application-config.git
You need to add cloud.config.server.git.searchPaths to the configuration server application.yml.
cloud:
config:
server:
git:
searchPaths: <directory>
Related
Is it possible to bootstrap spring config service with composite configuration.
Example:
Final configuration (placed on the git repo )
spring:
cloud:
config:
server:
composite:
- type: git
uri: <uri1>
- type: git
uri: <uri2>
After I setup env variable to bootstrap:
SPRING_CLOUD_CONFIG_SERVER_BOOTSTRAP = true
and provide setup to fetch configuration from repository spring config is not adding new configuration for additional repositories.
Is it possible to configure spring config server to bootstrap from one repository and then serve configuration from different one(s)?
I have configured "configure-server" by fetching all configuration from gitlab repository.
Currently, when application(config-server) start it fetch all application properties in git repo.
In case, I have two client application A,B
which has difference application properties like
aplication-a.yml
aplication-b.yml
when application A start, I just only want configure-service fetch only application-a.yml from git repositry.
Here is application configure:
Configure Server
server:
port: 9000
spring:
application:
name: CONFIG-SERVER
cloud:
config:
server:
git:
uri: https://gitlab.com/mama/cloud-configure-server.git
clone-on-start: true
default-label: main
Application A
spring:
cloud:
config:
enabled: true
uri: http://localhost:9000
How to tell configure-service fetch only application-a.yml from git repository?
In case, I don't want to fetch all?
Thank you!!
I want get the data from local file using spring cloud config server git.
I have tried with below Yaml config but it is not working.
server:
port: 8888
spring:
cloud:
config:
server:
git:
uri: file:///C:/spring-boot-ws/demo-springcloud-m2-configserver-git/pluralsight-spring-cloudconfig-wa-tolls-master/
My folder Structure is like
C: > spring-boot-ws > demo-springcloud-m2-configserver-git > pluralsight-spring-cloudconfig-wa-tolls-master > station1 > s1rates.properties
As its name suggest, using git means that you have to set the uri of the repository containing your configurations and not a local files. If you want to use local files you should configure your server like this:
spring:
profiles:
active: native
cloud:
config:
server:
native:
searchLocations: file:///...
I have two Spring Boot applications:
cloud-config
It has following file structure:
└───src
└───main
└───environment
└───default
├───application.yml
└───bootstrap.yml
...
application.yml:
server:
port: 8087
spring:
cloud:
config:
server:
git:
uri: ssh://path-to-repository.git
bootstrap.yml:
spring:
application:
name: cloud-config
main-application:
└───src
└───main
└───environment
└───default
├───bootstrap.yml
└───logback.xml
I have application.yml for my main-application in git repository.
Also in git repository I have file with properties: application-default.properties.
I want to move logback.xml to git repository to get it with spring-cloud. How can I do this?
To solve my task I have done following:
add logback.xml to my Spring Cloud repository;
remove logback.xml from main > environment > default directory;
add to bootstrap.yml of main-application module:
logging:
config: http://localhost:8087/main-application/default/master/logback.xml
Documentation: description of logging: config: path: Serving plain text
logging.config=${spring.cloud.config.uri}/guestservices/default/master/logback.xml
works for me.
I have all the common properties in application.properties file. version specific properties are in version1 and version2 folders in github.
order-service(base folder)
application.properties
version1
app-dev.properties
version2
app-dev.properties
How can I set the config in application.yml file to ensure cloud config server returns version 1 props along with with common props when version1 url is hit.Below is the config that I have now to fetch props from base folder and how could it be modified to achieve the above.
spring:
cloud:
config:
server:
git:
uri: https://github.company.com/orders-properties
username: orders
password: orders
search-paths: order-service
If I understood correctly this is what you need.
Lets say you have two apps called app-dev-v1 and app-dev-v2.
You need to add a bootstrap.yml file inside the resources folder and add this property on both the apps.
For app-dev-v1
spring:
application:
name: app-dev-v1
For app-dev-v2
spring:
application:
name: app-dev-v2
In the repository you can have a .yml or .properties file like this inside version1 and version2 folder.
app-dev-v1.yml and app-dev-v2.yml
Also for config server you need to add the search paths:
spring:
cloud:
config:
server:
git:
uri: https://github.company.com/orders-properties
username: orders
password: orders
search-paths: order-service,version*