Exemple #1
0
func (cmd *Push) removeRoutes(app models.Application, routeActor actors.RouteActor) {
	if len(app.Routes) == 0 {
		cmd.ui.Say(T("App {{.AppName}} is a worker, skipping route creation",
			map[string]interface{}{"AppName": terminal.EntityNameColor(app.Name)}))
	} else {
		routeActor.UnbindAll(app)
	}
}
Exemple #2
0
func (cmd *Push) updateRoutes(routeActor actors.RouteActor, app models.Application, appParams models.AppParams, noHostName bool) {
	defaultRouteAcceptable := len(app.Routes) == 0
	routeDefined := appParams.Domain != nil || appParams.Host != nil || noHostName

	domain := cmd.findDomain(appParams.Domain)
	hostname := cmd.hostnameForApp(appParams.Host, appParams.UseRandomHostname, app.Name, noHostName)

	if appParams.NoRoute {
		cmd.removeRoutes(app, routeActor)
	} else if routeDefined || defaultRouteAcceptable {
		route := routeActor.FindOrCreateRoute(hostname, domain)
		routeActor.BindRoute(app, route)
	}
}