refactor and remove unused code

This commit is contained in:
yusing
2025-02-10 09:52:53 +08:00
parent eaf191e350
commit 0a7b28caf5
15 changed files with 24 additions and 52 deletions

View File

@@ -37,26 +37,6 @@ func (handler *EventHandler) Handle(parent task.Parent, events []watcher.Event)
}
}
// if common.IsDebug {
// eventsLog := E.NewBuilder("events")
// for _, event := range events {
// eventsLog.Addf("event %s, actor: name=%s, id=%s", event.Action, event.ActorName, event.ActorID)
// }
// E.LogDebug(eventsLog.About(), eventsLog.Error(), handler.provider.Logger())
// oldRoutesLog := E.NewBuilder("old routes")
// for k := range oldRoutes {
// oldRoutesLog.Adds(k)
// }
// E.LogDebug(oldRoutesLog.About(), oldRoutesLog.Error(), handler.provider.Logger())
// newRoutesLog := E.NewBuilder("new routes")
// for k := range newRoutes {
// newRoutesLog.Adds(k)
// }
// E.LogDebug(newRoutesLog.About(), newRoutesLog.Error(), handler.provider.Logger())
// }
for k, oldr := range oldRoutes {
newr, ok := newRoutes[k]
switch {

View File

@@ -41,7 +41,6 @@ type (
// var globalMux = http.NewServeMux() // TODO: support regex subdomain matching.
// TODO: fix this for agent
func NewReverseProxyRoute(base *Route) (*ReveseProxyRoute, E.Error) {
httpConfig := base.HTTPConfig
proxyURL := base.ProxyURL

View File

@@ -280,14 +280,15 @@ func (r *Route) Finalize() {
}
if pp == 0 {
if isDocker {
switch {
case isDocker:
pp = lowestPort(cont.PrivatePortMapping)
if pp == 0 {
pp = lowestPort(cont.PublicPortMapping)
}
} else if r.Scheme == "https" {
case r.Scheme == "https":
pp = 443
} else {
default:
pp = 80
}
}