In the example which I am working on to test latest Spring Boot and Spring Cloud versions. I am using below versions in my pom.xml for Config Server.
spring-boot-starter-parent - 2.7.3
java.version - 17
spring-cloud.version - 2021.0.3
The application.yml
file in the config-server project has below configuraiton.
spring:
application:
name: config-server
cloud:
config:
server:
git:
default-label: main
clone-on-start: false
force-pull: false
search-paths:
- configstore/{application}
I am passing the other parameters like URL and username and password from runtime config, after Jar is run.
spring.cloud.config.server.git.uri
spring.cloud.config.server.git.uri.username
spring.cloud.config.server.git.uri.password
I added these clone-on-start
and force-pull
after I read this on some blog that by doing the Spring Cloud Server does not pull the config all the time, but still I can see different folders getting created in my AppData\Local\Temp
.
The folder with some specific names as config-repo-10289491717282597132
and the last 20 digit number keep on changing.
My question is, why such a need for Config Server to Download the configuration on a local directory like AppData\Local\Temp
.
And what can be the alternative to this to which way Spring Cloud Config Server does not need to download the yaml config files all the time.
There is one more issue which I can see, when the config server is up and running.
It shows this local AppData\Local\Temp
path when configuration is viewed from browser.
The propertySources name is viewed as shown below (example):
https://repodomain.com/xxuser/demo-project/file:C:\\Users\\xxuser\\AppData\\Local\\Temp\\config-repo-10289491717282597132\\configstore\\demo-service\\demo-service.yml
The details of one sample "demo-service" which is having configuration on the config-server. Image Screenshot is shared for the same.
Note: This question is not about setting the directory path to clone files locally, but to know why copying config files locally is required and can config server work without copying files locally.
Majorly I am looking for, when at runtime you fetch profile config, the "propertySources -> name" - it should not include xxxxxx/file:C:\\Users\\xxxxxxxxx
i.e. like reading config from a local file.
The "propertySources -> name" should be like https://repodomain.com/xxuser/demo-project/configstore/demo-service/demo-service.yml
.
Update as on 29-Sept-2022
I observed this issue when the Git Repository is GitHub, and in a similar project where repositories are stored in BitBucket, I can see the "propertySources -> name" just as specified in Note - example (which is as expected)