config: add depenv.MonitorDomain() and config.ManageURL() methods

This commit is contained in:
2025-04-19 23:07:08 -07:00
parent 0996167865
commit 62a7605869
2 changed files with 9 additions and 1 deletions

View File

@@ -11,7 +11,7 @@ import (
"go.ntppool.org/common/logger"
)
//go:generate accessory -type Config
//go:generate go tool github.com/masaushi/accessory -type Config
type Config struct {
deploymentMode string `accessor:"getter"`
@@ -50,6 +50,10 @@ func (c *Config) WebURL(path string, query *url.Values) string {
return baseURL(c.webHostname, c.webTLS, path, query)
}
func (c *Config) ManageURL(path string, query *url.Values) string {
return baseURL(c.manageHostname, c.webTLS, path, query)
}
func baseURL(host string, tls bool, path string, query *url.Values) string {
uri := url.URL{}
uri.Host = host