0

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.

Image Screenshot for Example from Browser how config displays the AppData Local Path


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)

Mandar Pandit
  • 2,171
  • 5
  • 36
  • 58
  • 1
    Does this answer your question? [Spring cloud config server -Set directory of folder where git repo are cloned](https://stackoverflow.com/questions/32317112/spring-cloud-config-server-set-directory-of-folder-where-git-repo-are-cloned) – Chin Huang Sep 23 '22 at 18:52
  • I am aware that option to set specific path for config repo on local. But still when fetched configuration properties it show the values as ```https://repodomain.com/xxuser/demo-project/file:C:\\Users\\xxuser\\AppData\\Local\\Temp\\config-repo-10289491717282597132\\configstore\\demo-service\\demo-service.yml```. This is not the answer to my question, – Mandar Pandit Sep 26 '22 at 05:30
  • Spring Cloud Config Server [uses JGit](https://github.com/spring-cloud/spring-cloud-config/blob/main/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/JGitEnvironmentRepository.java) to clone the remote repository. JGit implements the clone operation by copying the files from the remote repository to a working tree on the local file system. – Chin Huang Sep 26 '22 at 16:46

0 Answers0