ParseCaURLIfExists gets and parses the ca-url from the command context, if one is present. - Allow empty value. - Prepend an 'https' scheme if the URL does not have a scheme. - Error if the URL scheme is not implicitly or explicitly 'https'.
(ctx *cli.Context)
| 661 | // - Prepend an 'https' scheme if the URL does not have a scheme. |
| 662 | // - Error if the URL scheme is not implicitly or explicitly 'https'. |
| 663 | func ParseCaURLIfExists(ctx *cli.Context) (string, error) { |
| 664 | caURL := ctx.String("ca-url") |
| 665 | if caURL == "" { |
| 666 | return "", nil |
| 667 | } |
| 668 | return parseCaURL(ctx, caURL) |
| 669 | } |
| 670 | |
| 671 | func parseCaURL(ctx *cli.Context, caURL string) (string, error) { |
| 672 | if !strings.Contains(caURL, "://") { |
searching dependent graphs…