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

Function BootstrapAuthority

utils/cautils/bootstrap.go:297–317  ·  view source on GitHub ↗

BootstrapAuthority bootstraps an authority using only the caURL and fingerprint.

(ctx *cli.Context, caURL, fingerprint string)

Source from the content-addressed store, hash-verified

295
296// BootstrapAuthority bootstraps an authority using only the caURL and fingerprint.
297func BootstrapAuthority(ctx *cli.Context, caURL, fingerprint string) (err error) {
298 caHostname := ctx.String("authority")
299 if caHostname == "" {
300 if caHostname, err = getHost(caURL); err != nil {
301 return err
302 }
303 }
304
305 opts := []bootstrapOption{
306 withDefaultContextValues(caHostname),
307 }
308
309 if redirectURL := ctx.String("redirect-url"); redirectURL != "" {
310 if _, err := url.Parse(redirectURL); err != nil {
311 return err
312 }
313 opts = append(opts, withRedirectURL(redirectURL))
314 }
315
316 return bootstrap(ctx, caURL, fingerprint, opts...)
317}
318
319func getHost(caURL string) (string, error) {
320 u, err := url.Parse(caURL)

Callers 1

bootstrapActionFunction · 0.92

Calls 5

getHostFunction · 0.85
withDefaultContextValuesFunction · 0.85
withRedirectURLFunction · 0.85
bootstrapFunction · 0.85
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…