diff --git a/pkg/config/config.go b/pkg/config/config.go index ff88013d..89312a43 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -74,6 +74,19 @@ func NewLuetRepository(name, t, descr string, urls []string, priority int, enabl } } +func NewEmptyLuetRepository() *LuetRepository { + return &LuetRepository{ + Name: "", + Description: "", + Urls: []string{}, + Type: "", + Priority: 9999, + TreePath: "", + Enable: false, + Authentication: make(map[string]string, 0), + } +} + func (r *LuetRepository) String() string { return fmt.Sprintf("[%s] prio: %d, type: %s, enable: %t", r.Name, r.Priority, r.Type, r.Enable) } diff --git a/pkg/repository/loader.go b/pkg/repository/loader.go index 46e6365b..37b9375d 100644 --- a/pkg/repository/loader.go +++ b/pkg/repository/loader.go @@ -76,7 +76,7 @@ func LoadRepositories(c *LuetConfig) error { } func LoadRepository(data []byte) (*LuetRepository, error) { - ans := &LuetRepository{Enable: false} + ans := NewEmptyLuetRepository() err := yaml.Unmarshal(data, &ans) if err != nil { return nil, err