MCPcopy Create free account
hub / github.com/cloudfoundry/cli / createAndBindRoute

Method createAndBindRoute

cf/commands/application/push.go:426–460  ·  view source on GitHub ↗
(
	host *string,
	UseRandomRoute bool,
	UseRandomPort bool,
	app models.Application,
	noHostName bool,
	domain models.DomainFields,
	routePath *string,
)

Source from the content-addressed store, hash-verified

424}
425
426func (cmd *Push) createAndBindRoute(
427 host *string,
428 UseRandomRoute bool,
429 UseRandomPort bool,
430 app models.Application,
431 noHostName bool,
432 domain models.DomainFields,
433 routePath *string,
434) error {
435 var hostname string
436 if !noHostName {
437 switch {
438 case host != nil:
439 hostname = *host
440 case UseRandomPort:
441 // do nothing
442 case UseRandomRoute:
443 hostname = hostNameForString(app.Name) + "-" + cmd.wordGenerator.Babble()
444 default:
445 hostname = hostNameForString(app.Name)
446 }
447 }
448
449 var route models.Route
450 var err error
451 if routePath != nil {
452 route, err = cmd.routeActor.FindOrCreateRoute(hostname, domain, *routePath, 0, UseRandomPort)
453 } else {
454 route, err = cmd.routeActor.FindOrCreateRoute(hostname, domain, "", 0, UseRandomPort)
455 }
456 if err != nil {
457 return err
458 }
459 return cmd.routeActor.BindRoute(app, route)
460}
461
462var forbiddenHostCharRegex = regexp.MustCompile("[^a-z0-9-]")
463var whitespaceRegex = regexp.MustCompile(`[\s_]+`)

Callers 1

Calls 4

hostNameForStringFunction · 0.85
BabbleMethod · 0.65
FindOrCreateRouteMethod · 0.65
BindRouteMethod · 0.65

Tested by

no test coverage detected