Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Spring Cloud Config without Git repo

Is it possible to use Spring Cloud Config without using any Git repo at all? I'm trying to test it with a local directory with this in application.properties:

spring.cloud.config.server.git.uri=file://${user.dir}/src/main/resources/config-repo

But I get the following error:

java.lang.IllegalStateException: No .git at file://path/to/src/main/resources/config-repo

So is it not possible to use Spring Cloud if one is not using Git at all?

UPDATE:

Thanks to Spencer's advice, I added the following:

spring.profiles.active=native spring.cloud.config.server.native.searchLocations=${user.dir}/src/main/resources/configs

And I have a file "bar.properties" inside "configs" with the following contents:

foo: bar 

But the response I get is not reading the file:

{   "name": "bar",   "profiles": [     "default"   ],   "label": "master",   "propertySources": [] } 

The URL I'm using is http://localhost:8888/bar/default

Am I missing something else? Thanks again in advance!

like image 547
Turar Avatar asked Oct 16 '15 19:10

Turar


People also ask

How do you configure spring cloud configuration using application properties file?

Create one file called bootstrap. properties in the src\main\resources directory and add the below properties to connect with the config server along with some required configuration. #Active Profile - will relate to development properties file in the server. #the property file without any environment name at the end.

How do I override spring cloud config properties in local?

Overriding the Values of Remote Properties If you want to allow your applications to override the remote properties with their own System properties or config files, the remote property source has to grant it permission by setting spring. cloud. config. allowOverride=true (it doesn't work to set this locally).


1 Answers

Run with spring.profiles.active=native. See the File System Backend for more details. You'll want to set spring.cloud.config.server.native.searchLocations to the dirs you want to look at.

like image 78
spencergibb Avatar answered Oct 05 '22 02:10

spencergibb