2016-01-27 99 views
0

我正在尋找實現12factor方法來通過Spring Cloud Config來外化配置,但我無法像預期的那樣獲得使用searchPaths的通配符。spring cloud config searchPaths

文檔http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html#_spring_cloud_config_server提到通配符{application},{label},{profile}可以在searchPaths變量中使用,因此「您可以分隔路徑中的目錄並選擇一種對您有意義的策略(例如,每個應用程序的子目錄或每個配置文件的子目錄)

我正在尋找一個git倉庫,每個配置文件有子目錄(然後每個應用程序或每個應用程序的子目錄(然後通過簡檔)

例如

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

但是,當我在我的searchPaths中使用任何通配符{application}或{profile}時,它在git repo中找不到數據,或者連接選項無法啓動。

有沒有人有我可以參考的工作示例? Cheers Roy

+0

你沒有說你使用的是什麼版本的spring cloud config(這是最近的一個功能)。 –

回答

0

實際上,用戶指南中沒有一個示例顯示在searchPaths列表中使用的模式。我認爲該功能不受GIT後端支持(但{application}實際上是文件系統後端的默認設置,即在「本機」配置文件中工作的那個)。

+0

謝謝戴夫。你是對的。我誤讀了指南。它提到,對於'native',我們可以使用spring.cloud.config.server.native.searchLocations和佔位符,前一節中還提供了基於文件的repos的searchPaths示例。我認爲這些都是同樣的事情,因爲它們都是基於本地文件的,但看起來像被區別對待。 –

+0

我認爲向VCS回購庫中的搜索路徑添加佔位符是一個相當不錯的主意。隨意在GitHub中打開一個問題。 –

+0

完成。 https://github.com/spring-cloud/spring-cloud-config/issues/328 –

相關問題