package conf import ( "sync" "time" ) type Config struct { KubeHost string KubePort string KubeCA string KubeCert string KubeData string // PrepLeadSeconds must match oc-schedulerd's PREP_LEAD_SECONDS. // Used both as the ASAP buffer and as the minimum allowed lead time // when validating explicit booking start dates. PrepLeadSeconds int } func (c *Config) PrepLead() time.Duration { if c.PrepLeadSeconds <= 0 { return 2 * time.Minute } return time.Duration(c.PrepLeadSeconds) * time.Second } var instance *Config var once sync.Once func GetConfig() *Config { once.Do(func() { instance = &Config{} }) return instance }