eclipse/lib/config/schema.go

43 lines
858 B
Go
Raw Normal View History

2024-01-17 21:11:23 +00:00
// Copyright (C) 2024 Umorpha Systems
// SPDX-License-Identifier: AGPL-3.0-or-later
package config
import (
"encoding"
"time"
)
type Duration struct {
time.Duration
}
var _ encoding.TextUnmarshaler = (*Duration)(nil)
func (d *Duration) UnmarshalText(text []byte) error {
var err error
d.Duration, err = time.ParseDuration(string(text))
return err
}
type Config struct {
Daemon struct {
StateDir string `json:"state_dir"`
GitCacheDir string `json:"cache_git_dir"`
GitCacheFor Duration `json:"cache_git_for"`
ParallelDownloads int `json:"parallel_downloads"`
} `json:"daemon"`
Actions []Action `json:"actions"`
}
type Action struct {
Triggers []GitTrigger `json:"triggers"`
Run string `json:"run"`
}
type GitTrigger struct {
RepoURL string `json:"repo_url"`
Rev string `json:"rev"`
}