Merge pull request #205 from sgotti/remotesource_create_fix_forced_github_defaults

cmd: remotesource create don't force github defaults
This commit is contained in:
Simone Gotti 2020-02-11 16:16:33 +01:00 committed by GitHub
commit 2750598a86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -83,10 +83,16 @@ func init() {
func remoteSourceCreate(cmd *cobra.Command, args []string) error {
gwclient := gwclient.NewClient(gatewayURL, token)
flags := cmd.Flags()
// for github remote source type, set defaults for github.com
if remoteSourceCreateOpts.rsType == "github" {
remoteSourceCreateOpts.apiURL = github.GitHubAPIURL
remoteSourceCreateOpts.sshHostKey = github.GitHubSSHHostKey
if !flags.Changed("api-url") {
remoteSourceCreateOpts.apiURL = github.GitHubAPIURL
}
if remoteSourceCreateOpts.apiURL == github.GitHubAPIURL && !flags.Changed("ssh-host-key") {
remoteSourceCreateOpts.sshHostKey = github.GitHubSSHHostKey
}
}
if remoteSourceCreateOpts.apiURL == "" {