MCPcopy Create free account
hub / github.com/anchordotdev/cli / checkHTTPS

Method checkHTTPS

lcl/bootstrap.go:314–364  ·  view source on GitHub ↗
(ctx context.Context, cfg *cli.Config, drv *ui.Driver, srv *api.Service, diagPort string, requestc <-chan string)

Source from the content-addressed store, hash-verified

312}
313
314func (c Bootstrap) checkHTTPS(ctx context.Context, cfg *cli.Config, drv *ui.Driver, srv *api.Service, diagPort string, requestc <-chan string) error {
315 domain := srv.Slug + ".lcl.host" // TODO: look this up properly
316
317 httpsURL, err := url.Parse("https://" + domain + ":" + diagPort)
318 if err != nil {
319 return err
320 }
321 httpsConfirmCh := make(chan struct{})
322
323 drv.Activate(ctx, &models.Bootstrap{
324 ConfirmCh: httpsConfirmCh,
325
326 Domain: domain,
327 Port: diagPort,
328 Scheme: "https",
329 ShowHeader: true,
330 })
331
332 drv.Send(models.OpenURLMsg(httpsURL.String()))
333
334 select {
335 case <-httpsConfirmCh:
336 case <-ctx.Done():
337 return ctx.Err()
338 }
339
340 var browserless bool
341 if !cfg.Trust.MockMode {
342 if err := browser.OpenURL(httpsURL.String()); err != nil {
343 browserless = true
344 drv.Activate(ctx, models.Browserless)
345 }
346 }
347
348 var requestedScheme string
349 if !browserless {
350 for requestedScheme != "https" {
351 select {
352 case requestedScheme = <-requestc:
353 case <-ctx.Done():
354 return ctx.Err()
355 }
356 }
357 }
358
359 drv.Activate(ctx, &models.BootstrapSuccess{
360 URL: httpsURL,
361 })
362
363 return nil
364}
365
366func (c Bootstrap) diagnosticServiceName(ctx context.Context, drv *ui.Driver, defaultSubdomain string) (string, error) {
367 inputc := make(chan string)

Callers 1

performMethod · 0.95

Calls 3

ActivateMethod · 0.80
SendMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected