cmd: remotesource create don't force github defaults
Use default public github api only if no api-url is provided. Use default public github ssh host key only if the public github api url is provided and no ssh host key is provided.
This commit is contained in:
parent
3b09cfd6a6
commit
75541ad730
|
@ -83,11 +83,17 @@ 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" {
|
||||
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 == "" {
|
||||
return errors.Errorf(`required flag "api-url" not set`)
|
||||
|
|
Loading…
Reference in New Issue