git-project-manager/internal/config/config.go

41 lines
1.1 KiB
Go
Raw Normal View History

2023-12-05 21:56:47 +00:00
package config
import "time"
type Config struct {
GitlabHost string `yaml:"gitlabHost" json:"gitlabHost"`
GitlabToken string `yaml:"gitlabToken" json:"gitlabToken"`
LogLevel string `yaml:"logLevel" json:"logLevel" enum:"info,warn,debug,error"`
ProjectPath string `yaml:"projectPath" json:"projectPath"`
Cache cacheConfig `yaml:"cache" json:"cache"`
2023-12-08 21:52:26 +00:00
Dump struct {
Full bool
}
2023-12-05 21:56:47 +00:00
}
2023-12-10 15:10:46 +00:00
type loadConfig struct {
OwnerOnly bool `yaml:"ownerOnly" json:"ownerOnly"`
}
2023-12-05 21:56:47 +00:00
type cacheConfig struct {
2023-12-10 15:10:46 +00:00
Ttl time.Duration `yaml:"ttl,omitempty" json:"ttl,omitempty"`
File string `yaml:"file,omitempty" json:"file,omitempty"`
Load loadConfig `yaml:"load" json:"load"`
2023-12-07 17:08:56 +00:00
Clear struct {
2023-12-10 15:10:46 +00:00
ClearAliases bool `yaml:"clearAliases,omitempty" json:"clearAliases,omitempty"`
} `yaml:"clear,omitempty" json:"clear,omitempty"`
}
var DefaultConfig = Config{
GitlabHost: "https://gitlab.com",
GitlabToken: "yourtokenhere",
LogLevel: "warn",
ProjectPath: "~/work/projects",
Cache: cacheConfig{
Ttl: 168 * time.Hour,
Load: loadConfig{
OwnerOnly: true,
},
},
2023-12-05 21:56:47 +00:00
}