This commit is contained in:
ginuerzh 2019-01-08 13:08:24 +08:00
parent 81bb436e6c
commit 1930da5210
2 changed files with 5 additions and 5 deletions

View File

@ -38,10 +38,6 @@ func parseBaseConfig(s string) (*baseConfig, error) {
return baseCfg, nil
}
func (cfg *baseConfig) IsValid() bool {
return len(cfg.route.ServeNodes) > 0
}
var (
defaultCertFile = "cert.pem"
defaultKeyFile = "key.pem"

View File

@ -2,6 +2,7 @@ package main
import (
"crypto/tls"
"errors"
"flag"
"fmt"
"os"
@ -45,7 +46,7 @@ func init() {
os.Exit(1)
}
}
if flag.NFlag() == 0 || !baseCfg.IsValid() {
if flag.NFlag() == 0 {
flag.PrintDefaults()
os.Exit(0)
}
@ -97,6 +98,9 @@ func start() error {
routers = append(routers, rts...)
}
if len(routers) == 0 {
return errors.New("invalid config")
}
for i := range routers {
go routers[i].Serve()
}