mirror of
https://github.com/mudler/luet.git
synced 2025-09-17 07:42:25 +00:00
Define default values for loaded repositories
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user