errors.Wrap implemented, removed redundant default port check
This commit is contained in:
@@ -9,7 +9,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/hpcng/warewulf/internal/pkg/warewulfconf"
|
"github.com/hpcng/warewulf/internal/pkg/warewulfconf"
|
||||||
"github.com/hpcng/warewulf/internal/pkg/wwlog"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: https://github.com/danderson/netboot/blob/master/pixiecore/dhcp.go
|
// TODO: https://github.com/danderson/netboot/blob/master/pixiecore/dhcp.go
|
||||||
@@ -43,23 +43,15 @@ func RunServer() error {
|
|||||||
|
|
||||||
conf, err := warewulfconf.New()
|
conf, err := warewulfconf.New()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
wwlog.Printf(wwlog.ERROR, "Could not get Warewulf configuration: %s\n", err)
|
return errors.Wrap(err, "could not get Warewulf configuration")
|
||||||
os.Exit(1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
daemonPort := 9873
|
daemonPort := conf.Warewulf.Port
|
||||||
if conf.Warewulf.Port != daemonPort {
|
daemonLogf("Starting HTTPD REST service on port %d\n", daemonPort)
|
||||||
daemonPort = conf.Warewulf.Port
|
|
||||||
} else {
|
|
||||||
fmt.Printf("INFO: warewulfd port not configured, defaulting to 9873\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
daemonLogf("Starting HTTPD REST service\n")
|
|
||||||
|
|
||||||
err = http.ListenAndServe(":" + strconv.Itoa(daemonPort), nil)
|
err = http.ListenAndServe(":" + strconv.Itoa(daemonPort), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("ERROR: Could not start listening service: %s\n", err)
|
return errors.Wrap(err, "Could not start listening service")
|
||||||
os.Exit(1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user