Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

spring cloud config searchPaths

I'm looking at implementing the 12factor approach to externalising config via Spring Cloud Config but am not able to get the wildcards working using searchPaths as I expected.

The documentation http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html#_spring_cloud_config_server mentions that wildcards {application}, {label}, {profile} can be used within the searchPaths variable so that "you can segregate the directories in the path, and choose a strategy that makes sense for you (e.g. sub-directory per application, or sub-directory per profile)."

I'm looking to have a single git repo, with either subdirectories per profile (and then per app, or subdirectory per app (then by profile).

e.g.

    spring:
      cloud:
        config:
          server:
            git:
              uri: https://stash.xxx.com.au/scm/xxx/config
              searchPaths: {application}
or
              searchPaths: {profile}
or
              searchPaths: {application}/{profile}

However when I use any of the wildcards {application} or {profile} in my searchPaths it doesn't find the data in the git repo, or for the concatenated option fails to startup at all.

Does anyone have a working example of this I can refer to? Cheers Roy

like image 1000
roy henley Avatar asked Dec 18 '22 20:12

roy henley


2 Answers

Use single quote and it works fine.

searchPaths: '{application}'

Hope this helps if someone stumbles across this problem.

like image 93
vm-s3pl Avatar answered Dec 28 '22 07:12

vm-s3pl


Actually none of the examples in the user guide show the pattern being used in a list of searchPaths. I don't think that feature is supported with the GIT backend (but {application} is effectively the default in the filesystem backend, i.e. the one that works in the "native" profile).

like image 36
Dave Syer Avatar answered Dec 28 '22 07:12

Dave Syer