Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Cloud Config Server - User id and Password to connect to github

I looked at the code for a number of spring cloud config servers in github repo and below are the 2 values that are provided as part of property file. I believe in order to connect to https end point of github , user id and password are also necessary. Could these perhaps be part of environment variables?

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

EDIT:

Below is the example that I saw in spring website. However in all the github repos within my enterprise I don't see userid and password being set as they are sensitive info. How could it be set or config server access github url , if uid / pwd is not provided in the property file?

spring:
  cloud:
    config:
      server:
        git:
          uri: https://github.com/spring-cloud-samples/config-repo
          username: trolley
          password: strongpassword
like image 297
Punter Vicky Avatar asked Dec 23 '22 04:12

Punter Vicky


1 Answers

  1. for public repository there is no need to use username and password or other authorizations to get config properties, for private repository auth are required.
  2. it is possible to set variable from enviroment which from os or java-system-property and command line. for precedence: command-line-param > java-system-property > os-env > application.properties.

So, for example what if i set property use command-line directly (which has highest precedence.) like:

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

which contain all param in CI tools or whatever then managed by someone, you wouldn't see that in source code.

like image 92
Se ven Avatar answered Dec 28 '22 06:12

Se ven