func (d *Deployment) GetSchedule() ([]*schedule.Schedule, error) {
	var err error
	if d.parsed {
		return d.schedule, nil
	}
	d.parsed = true
	d.schedule, err = parseSchedule(d.Schedule)
	return d.schedule, err
}
GetSchedule will parse the schedule strings and return an array of schedule
objects, or an error if the schedule strings are invalid.
package config
import (
	"io/ioutil"
	"strings"
	"gopkg.in/yaml.v2"
	"github.com/joyrex2001/nightshift/internal/schedule"
)
func New(file string) (*Config, error) {
	y, err := ioutil.ReadFile(file)
	if err != nil {
		return nil, err
	}
	m, err := loadConfig(y)
	if err != nil {
		return nil, err
	}
	if err = m.processSchedule(); err != nil {
		return nil, err
	}
	m.processDefaults()
	m.processTriggers()
	return m, nil
}
func loadConfig(y []byte) (*Config, error) {
	cfg := &Config{}
	err := yaml.Unmarshal(y, cfg)
	if err != nil {
		return nil, err
	}
	return cfg, nil
}
func (c *Config) processDefaults() {
	for _, scan := range c.Scanner {
		if scan.Type == "" {
			scan.Type = "openshift"
		}
	}
}
func (c *Config) processTriggers() {
	for _, trgr := range c.Trigger {
		trgr.Id = strings.ToLower(trgr.Id)
		trgr.Type = strings.ToLower(trgr.Type)
		cfg := map[string]string{}
		for k, v := range trgr.Config {
			cfg[strings.ToLower(k)] = v
		}
		trgr.Config = cfg
	}
}
func (c *Config) processSchedule() error {
	for _, scan := range c.Scanner {
		if _, err := scan.Default.GetSchedule(); err != nil {
			return err
		}
		for _, depl := range scan.Deployment {
			if _, err := depl.GetSchedule(); err != nil {
				return err
			}
		}
	}
	return nil
}
func (d *Default) GetId() string {
	if d != nil {
		return d.Id
	}
	return ""
}
func (d *Default) GetSchedule() ([]*schedule.Schedule, error) {
	var err error
	if d == nil {
		return nil, nil
	}
	if d.parsed {
		return d.schedule, nil
	}
	d.parsed = true
	d.schedule, err = parseSchedule(d.Schedule)
	return d.schedule, err
}