make the configuration to be based in warewulf.conf

defaults will be se by the Makefile

Signed-off-by: Christian Goll <cgoll@suse.de>
This commit is contained in:
Christian Goll
2023-03-03 16:02:41 +01:00
parent f2eff0f7b8
commit 4deae97bc8
18 changed files with 130 additions and 174 deletions

View File

@@ -5,11 +5,9 @@ import (
"fmt"
"net"
"os"
"path"
"github.com/brotherpowers/ipsubnet"
"github.com/creasty/defaults"
"github.com/hpcng/warewulf/internal/pkg/buildconfig"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
"gopkg.in/yaml.v2"
)
@@ -18,18 +16,6 @@ var cachedConf ControllerConf
var ConfigFile string
/*
Get the configFile location from the os.ev if set
*/
func init() {
if ConfigFile == "" {
ConfigFile = os.Getenv("WARWULFCONF")
}
if ConfigFile == "" {
ConfigFile = path.Join(buildconfig.SYSCONFDIR(), "warewulf/warewulf.conf")
}
}
/*
Creates a new empty ControllerConf object, returns a cached
one if called in a nother context.
@@ -42,10 +28,9 @@ func New() (ret ControllerConf) {
ret.Dhcp = new(DhcpConf)
ret.Tftp = new(TftpConf)
ret.Nfs = new(NfsConf)
err := defaults.Set(&ret)
if err != nil {
ret.setDynamicDefaults()
}
ret.Paths = new(BuildConfig)
_ = defaults.Set(&ret)
ret.setDynamicDefaults()
cachedConf = ret
cachedConf.current = true