BootstrapAuthority bootstraps an authority using only the caURL and fingerprint.
(ctx *cli.Context, caURL, fingerprint string)
| 295 | |
| 296 | // BootstrapAuthority bootstraps an authority using only the caURL and fingerprint. |
| 297 | func 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 | |
| 319 | func getHost(caURL string) (string, error) { |
| 320 | u, err := url.Parse(caURL) |
no test coverage detected
searching dependent graphs…