Move SSH key path to a flag

This commit is contained in:
Thomas Jackson 2019-01-17 14:32:26 -08:00
parent 1c3af08207
commit c4c68e2620
1 changed files with 3 additions and 1 deletions

View File

@ -69,6 +69,8 @@ var flPassword = flag.String("password", envString("GIT_SYNC_PASSWORD", ""),
var flSSH = flag.Bool("ssh", envBool("GIT_SYNC_SSH", false),
"use SSH for git operations")
var flSSHSecret = flag.String("ssh-key", envString("GIT_SSH_KEY", "/etc/git-secret/ssh"),
"the ssh key to use")
var flSSHKnownHosts = flag.Bool("ssh-known-hosts", envBool("GIT_KNOWN_HOSTS", true),
"enable SSH known_hosts verification")
@ -513,7 +515,7 @@ func setupGitAuth(username, password, gitURL string) error {
func setupGitSSH(setupKnownHosts bool) error {
log.V(1).Infof("setting up git SSH credentials")
var pathToSSHSecret = "/etc/git-secret/ssh"
var pathToSSHSecret = *flSSHSecret
var pathToSSHKnownHosts = "/etc/git-secret/known_hosts"
fileInfo, err := os.Stat(pathToSSHSecret)