I am trying to use Spring-Cloud Config to build a configuration server that will allow others apps to register directories/files to be notified of any events (file modification/creation/deletion) that occur.
I'm currently limited to storing our configuration files on filesystems, so pointing to a git repo won't work.
This is my current applications.properties:
server.port=8888 spring.profiles.active=native spring.cloud.config.server.native.searchLocations=C:/Users/xxxx/Documents/other/test-config-dir
From what I've researched so far, Spring-Cloud config server points to a location to watch on startup through this application.properties file. Is there any way for me to add searchLocations without restarting the server?
For git repos, I think this would be possible since you can hit endpoints to get configs from branches of said repo right? But would this even be possible when pointing to a location on the filesystem?
The git-based services use hooks to post at a specific endpoint. You could use this endpoint ( /monitor
) to trigger the refreshes on your own, for example by sending a request there at regular interval or by implementing a logic that would send that request whenever the file changes - similarly to how github hooks work-. You can find more information about setting up the /monitor
enpoint in the Spring Cloud Config Docs in the section "Push Notifications and Spring Cloud Bus".
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.