代码之家  ›  专栏  ›  技术社区  ›  Punter Vicky

Spring Cloud Config Server-连接到github的用户id和密码

  •  2
  • Punter Vicky  · 技术社区  · 8 年前

    我查看了github repo中许多spring云配置服务器的代码,下面是作为属性文件的一部分提供的2个值。我相信为了连接到github的https端点,用户id和密码也是必要的。这些可能是环境变量的一部分吗?

    server.port=7070
    spring.cloud.config.server.git.uri=https://
    

    编辑:

    下面是我在spring网站上看到的例子。然而,在我的企业中的所有github repos中,我没有看到设置用户id和密码,因为它们是敏感信息。如果属性文件中没有提供uid/pwd,如何设置或配置服务器访问github url?

    spring:
      cloud:
        config:
          server:
            git:
              uri: https://github.com/spring-cloud-samples/config-repo
              username: trolley
              password: strongpassword
    
    1 回复  |  直到 8 年前
        1
  •  7
  •   Se ven    8 年前
    1. 对于 公共存储库 没有必要使用 用户名 或获取配置属性的其他授权,例如 专用存储库 需要身份验证。
    2. 可以从操作系统或java系统属性和命令行设置环境变量。优先顺序: 命令行参数>java系统属性>操作系统环境>application.properties .

    例如,如果我直接设置属性use command-line(它具有最高的优先级),比如:

    java -jar config-server.jar --spring.cloud.config.server.git.username=xxx --spring.cloud.config.server.git.password=xxx

    它包含CI工具中的所有param,或者由某人管理的任何东西,您在源代码中看不到。

        2
  •  0
  •   girish mahajan    5 年前

    简单的小费-

    去github.com -&燃气轮机;开发人员设置->创建访问令牌,然后创建一个仅具有读取repo特权的访问令牌。这样就可以在不提供纯文本密码的情况下公开私有存储库!

    像这样的-

    spring.cloud.config文件.server.git.password=0371abshak3048sa8d81828488483sd302