Since BaseConf.New could return a cached BaseConf, rather than always constructing a new struct, I've renamed it to Get to more accurately reflect its use. A new New() method is called by Get and always initializes a new struct. Signed-off-by: Jonathon Anderson <janderson@ciq.co>
20 lines
506 B
Go
20 lines
506 B
Go
package start
|
|
|
|
import (
|
|
warewulfconf "github.com/hpcng/warewulf/internal/pkg/config"
|
|
"github.com/hpcng/warewulf/internal/pkg/warewulfd"
|
|
"github.com/pkg/errors"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func CobraRunE(cmd *cobra.Command, args []string) error {
|
|
|
|
if SetForeground {
|
|
conf := warewulfconf.Get()
|
|
conf.Warewulf.Syslog = false
|
|
return errors.Wrap(warewulfd.RunServer(), "failed to start Warewulf server")
|
|
} else {
|
|
return errors.Wrap(warewulfd.DaemonStart(), "failed to start Warewulf server")
|
|
}
|
|
}
|