config: add depenv.MonitorDomain() and config.ManageURL() methods
This commit is contained in:
parent
0996167865
commit
62a7605869
@ -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
|
||||
|
@ -69,6 +69,10 @@ func (d DeploymentEnvironment) ManageURL(path string) string {
|
||||
return manageServers[d] + path
|
||||
}
|
||||
|
||||
func (d DeploymentEnvironment) MonitorDomain() string {
|
||||
return d.String() + ".mon.ntppool.dev"
|
||||
}
|
||||
|
||||
func (d *DeploymentEnvironment) UnmarshalText(text []byte) error {
|
||||
s := string(text)
|
||||
if s == "" {
|
||||
|
Loading…
x
Reference in New Issue
Block a user