93 lines
3.2 KiB
Go
93 lines
3.2 KiB
Go
package config
|
|
|
|
import (
|
|
"path"
|
|
|
|
"github.com/warewulf/warewulf/internal/pkg/util"
|
|
)
|
|
|
|
var ConfigFile = "@SYSCONFDIR@/warewulf/warewulf.conf"
|
|
|
|
type BuildConfig struct {
|
|
Bindir string `yaml:"bindir,omitempty" default:"@BINDIR@"`
|
|
Sysconfdir string `yaml:"sysconfdir,omitempty" default:"@SYSCONFDIR@"`
|
|
Localstatedir string `yaml:"localstatedir,omitempty" default:"@LOCALSTATEDIR@"`
|
|
Cachedir string `yaml:"cachedir,omitempty" default:"@CACHEDIR@"`
|
|
Ipxesource string `yaml:"ipxesource,omitempty" default:"@IPXESOURCE@"`
|
|
Srvdir string `yaml:"srvdir,omitempty" default:"@SRVDIR@"`
|
|
Firewallddir string `yaml:"firewallddir,omitempty" default:"@FIREWALLDDIR@"`
|
|
Systemddir string `yaml:"systemddir,omitempty" default:"@SYSTEMDDIR@"`
|
|
Datadir string `yaml:"datadir,omitempty" default:"@DATADIR@"`
|
|
WWOverlaydir string `yaml:"wwoverlaydir,omitempty" default:"@WWOVERLAYDIR@"`
|
|
WWChrootdir string `yaml:"wwchrootdir,omitempty" default:"@WWCHROOTDIR@"`
|
|
WWProvisiondir string `yaml:"wwprovisiondir,omitempty" default:"@WWPROVISIONDIR@"`
|
|
WWClientdir string `yaml:"wwclientdir,omitempty" default:"@WWCLIENTDIR@"`
|
|
}
|
|
|
|
const Version = "@VERSION@"
|
|
const Release = "@RELEASE@"
|
|
|
|
type TFTPConf struct {
|
|
EnabledP *bool `yaml:"enabled" default:"true"`
|
|
TftpRoot string `yaml:"tftproot,omitempty" default:"@TFTPDIR@"`
|
|
SystemdName string `yaml:"systemd name,omitempty" default:"tftp"`
|
|
|
|
IpxeBinaries map[string]string `yaml:"ipxe,omitempty" default:"{\"00:09\": \"ipxe-snponly-x86_64.efi\",\"00:00\": \"undionly.kpxe\",\"00:0B\": \"arm64-efi/snponly.efi\",\"00:07\": \"ipxe-snponly-x86_64.efi\"}"`
|
|
}
|
|
|
|
func (this TFTPConf) Enabled() bool {
|
|
return util.BoolP(this.EnabledP)
|
|
}
|
|
|
|
// WarewulfConf adds additional Warewulf-specific configuration to
|
|
// BaseConf.
|
|
type WarewulfConf struct {
|
|
Port int `yaml:"port,omitempty" default:"9873"`
|
|
SecureP *bool `yaml:"secure,omitempty" default:"true"`
|
|
UpdateInterval int `yaml:"update interval,omitempty" default:"60"`
|
|
AutobuildOverlaysP *bool `yaml:"autobuild overlays,omitempty" default:"true"`
|
|
EnableHostOverlayP *bool `yaml:"host overlay,omitempty" default:"true"`
|
|
SyslogP *bool `yaml:"syslog,omitempty" default:"false"`
|
|
GrubBootP *bool `yaml:"grubboot,omitempty" default:"false"`
|
|
}
|
|
|
|
func (this WarewulfConf) Secure() bool {
|
|
return util.BoolP(this.SecureP)
|
|
}
|
|
|
|
func (this WarewulfConf) AutobuildOverlays() bool {
|
|
return util.BoolP(this.AutobuildOverlaysP)
|
|
}
|
|
|
|
func (this WarewulfConf) EnableHostOverlay() bool {
|
|
return util.BoolP(this.EnableHostOverlayP)
|
|
}
|
|
|
|
func (this WarewulfConf) Syslog() bool {
|
|
return util.BoolP(this.SyslogP)
|
|
}
|
|
|
|
func (this WarewulfConf) GrubBoot() bool {
|
|
return util.BoolP(this.GrubBootP)
|
|
}
|
|
|
|
func (paths BuildConfig) NodesConf() string {
|
|
return path.Join(paths.Sysconfdir, "warewulf", "nodes.conf")
|
|
}
|
|
|
|
func (paths BuildConfig) OciBlobCachedir() string {
|
|
return path.Join(paths.Cachedir, "warewulf")
|
|
}
|
|
|
|
func (paths BuildConfig) SiteOverlaydir() string {
|
|
return paths.WWOverlaydir
|
|
}
|
|
|
|
func (paths BuildConfig) DistributionOverlaydir() string {
|
|
return path.Join(paths.Datadir, "warewulf", "overlays")
|
|
}
|
|
|
|
func (paths BuildConfig) OverlayProvisiondir() string {
|
|
return path.Join(paths.WWProvisiondir, "overlays")
|
|
}
|