亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Spring Cloud Config Server - 用于連接到 github 的用戶

Spring Cloud Config Server - 用于連接到 github 的用戶

飲歌長嘯 2021-09-26 17:21:28
我查看了 github 存儲庫中許多 spring 云配置服務器的代碼,下面是作為屬性文件的一部分提供的 2 個值。我相信為了連接到 github 的 https 端點,用戶 ID 和密碼也是必要的。這些可能是環境變量的一部分嗎?server.port=7070spring.cloud.config.server.git.uri=https://編輯:下面是我在 spring 網站上看到的示例。但是,在我企業內的所有 github 存儲庫中,我沒有看到用戶 ID 和密碼被設置,因為它們是敏感信息。如果屬性文件中未提供 uid / pwd ,如何設置或配置服務器訪問 github url ?spring:  cloud:    config:      server:        git:          uri: https://github.com/spring-cloud-samples/config-repo          username: trolley          password: strongpassword
查看完整描述

4 回答

?
拉風的咖菲貓

TA貢獻1995條經驗 獲得超2個贊

是的,只需使用這樣的變量:



    spring.cloud.config.server.git.uri=${GIT_REPO_URL}

    spring.cloud.config.server.git.username=${GIT_USERNAME}

    spring.cloud.config.server.git.password=${GIT_TOKEN}


并在任何 CI 上設置這些環境變量。例如作為 GitHub Actions 上的秘密:



    - name: Build config-service

      env:

         GIT_REPO_URL: ${{ secrets.GIT_REPO_URL }}

         GIT_USERNAME: ${{ secrets.GIT_USERNAME }}

         GIT_TOKEN: ${{ secrets.GIT_TOKEN }}


似乎您不能再使用密碼來訪問 GitHub,您需要在此處頂部傳遞 GitHub 令牌 spring.cloud.config.server.git.password


查看完整回答
反對 回復 2021-09-26
  • 4 回答
  • 0 關注
  • 202 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號