MCPcopy
hub / github.com/smallstep/cli / ParseCaURLIfExists

Function ParseCaURLIfExists

flags/flags.go:663–669  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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'.
663func 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
671func parseCaURL(ctx *cli.Context, caURL string) (string, error) {
672 if !strings.Contains(caURL, "://") {

Callers 9

GetClientMethod · 0.92
GenerateTokenMethod · 0.92
GenerateSSHTokenMethod · 0.92
NewAdminClientFunction · 0.92
getClientMethod · 0.92
GenerateTokenMethod · 0.92
bootstrapActionFunction · 0.92
TestParseCaURLIfExistsFunction · 0.85

Calls 2

parseCaURLFunction · 0.85
StringMethod · 0.65

Tested by 1

TestParseCaURLIfExistsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…