let http.Server use the main app logger

This commit is contained in:
2024-12-07 22:18:07 +09:00
parent 6d87351e5e
commit 8821506fb1
5 changed files with 48 additions and 6 deletions

View File

@ -42,20 +42,23 @@ type ClientTLSConfig struct {
type ServerConfig struct {
CTL struct {
TLS ServerTLSConfig `yaml:"tls"`
TLS ServerTLSConfig `yaml:"tls"`
ServiceAddrs []string `yaml:"service-addrs"`
} `yaml:"ctl"`
RPC struct {
TLS ServerTLSConfig `yaml:"tls"`
TLS ServerTLSConfig `yaml:"tls"`
ServiceAddrs []string `yaml:"service-addrs"`
} `yaml:"rpc"`
}
type ClientConfig struct {
CTL struct {
TLS ServerTLSConfig `yaml:"tls"`
TLS ServerTLSConfig `yaml:"tls"`
ServiceAddrs []string `yaml:"service-addrs"`
} `yaml:"ctl"`
RPC struct {
TLS ClientTLSConfig `yaml:"tls"`
TLS ClientTLSConfig `yaml:"tls"`
} `yaml:"rpc"`
}

View File

@ -251,7 +251,7 @@ func main() {
goto wrong_usage
}
if len(rpc_addrs) < 1 || flgs.NArg() > 0 {
if len(rpc_addrs) <= 0 || flgs.NArg() > 0 {
goto wrong_usage
}
@ -263,6 +263,8 @@ func main() {
}
}
if len(ctl_addrs) <= 0 { ctl_addrs = cfg.CTL.ServiceAddrs }
err = server_main(ctl_addrs, rpc_addrs, cfg)
if err != nil {
fmt.Fprintf(os.Stderr, "ERROR: server error - %s\n", err.Error())
@ -297,7 +299,7 @@ func main() {
goto wrong_usage
}
if len(rpc_addrs) < 1 {
if len(rpc_addrs) <= 0 {
goto wrong_usage
}
@ -309,6 +311,8 @@ func main() {
}
}
if len(ctl_addrs) < 1 { ctl_addrs = cfg.CTL.ServiceAddrs }
err = client_main(ctl_addrs, rpc_addrs[0], flgs.Args(), cfg)
if err != nil {
fmt.Fprintf(os.Stderr, "ERROR: client error - %s\n", err.Error())