initial support of homepage labels

This commit is contained in:
yusing
2024-10-03 02:53:05 +08:00
parent ae61a2335d
commit 90130411f9
7 changed files with 76 additions and 39 deletions

View File

@@ -7,6 +7,8 @@ import (
. "github.com/yusing/go-proxy/internal/common"
D "github.com/yusing/go-proxy/internal/docker"
H "github.com/yusing/go-proxy/internal/homepage"
U "github.com/yusing/go-proxy/internal/utils"
F "github.com/yusing/go-proxy/internal/utils/functional"
)
@@ -18,9 +20,10 @@ type (
Scheme string `yaml:"scheme" json:"scheme"`
Host string `yaml:"host" json:"host"`
Port string `yaml:"port" json:"port"`
NoTLSVerify bool `yaml:"no_tls_verify" json:"no_tls_verify"` // https proxy only
PathPatterns []string `yaml:"path_patterns" json:"path_patterns"` // http(s) proxy only
Middlewares D.NestedLabelMap `yaml:"middlewares" json:"middlewares"`
NoTLSVerify bool `yaml:"no_tls_verify" json:"no_tls_verify,omitempty"` // https proxy only
PathPatterns []string `yaml:"path_patterns" json:"path_patterns,omitempty"` // http(s) proxy only
Middlewares D.NestedLabelMap `yaml:"middlewares" json:"middlewares,omitempty"`
Homepage *H.HomePageItem `yaml:"homepage" json:"homepage"`
/* Docker only */
*D.ProxyProperties `yaml:"-" json:"proxy_properties"`
@@ -37,6 +40,11 @@ func (e *RawEntry) FillMissingFields() {
e.ProxyProperties = &D.ProxyProperties{}
}
if e.Homepage == nil {
e.Homepage = H.HomePageItemDefault()
e.Homepage.Name = U.Title(e.Alias)
}
lp, pp, extra := e.splitPorts()
if port, ok := ServiceNamePortMapTCP[e.ImageName]; ok {