簡體   English   中英

Spring 雲配置 - Git 后端

[英]Spring Cloud Config - Git backend

我瀏覽了 Spring Cloud Config 的文檔,我了解到 Spring 更喜歡使用 Git 作為配置存儲庫,因為它支持標簽/分支等,它也是 Spring Cloud Config 的默認選項。
現在我有兩個問題

  1. 我習慣於將所有屬性存儲在服務器上(12-factor app t.nets 之一)。 所以我很困惑為什么 Git repo 被建議用於配置,這很容易被組織內的其他人看到,尤其是在存儲生產配置時
  2. 我的第二個問題是關於在屬性文件中存儲 {cipher}ed 值。 同樣,雖然該值已加密,但仍將加密文本保留在 Git 中似乎不是一個好方法。

請求任何人提供對這些問題的見解。

您可以將配置服務器與存儲在主機上的本地屬性文件一起使用。 為此,您只需使用具有以下屬性的本機profile

spring.profiles.active=native
spring.cloud.config.server.native.searchLocations=file:///C:/path/to/your/config/folder

然后不再需要以下屬性來設置您的 Git 存儲庫:

#spring.cloud.config.server.git.uri=...
#spring.cloud.config.server.git.username=...
#spring.cloud.config.server.git.password=...
#spring.cloud.config.server.git.timeout=10
#spring.cloud.config.server.git.clone-on-start=true

您可以禁用 Git ssl config - git config --global http.sslVerify false

創建一個 Git 個人訪問令牌。 使用令牌保存在 spring.cloud.config.token 屬性中。 在 application.yml 中使用下面的配置

服務器:

    git:

      uri: https://github.com/AKS/config/

      OR

      uri: file:///AKS/config/

      skipSslValidation: true

      search-paths:

        - config-map

      try-master-branch: false

      username: user

      password: ******

      default-label: <branch-name-git-branch>

      clone-on-start: true

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM