2023-12-05 21:56:47 +00:00
|
|
|
package config
|
|
|
|
|
2024-01-17 13:13:58 +00:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/info"
|
|
|
|
)
|
2023-12-05 21:56:47 +00:00
|
|
|
|
|
|
|
type Config struct {
|
2024-01-14 15:33:15 +00:00
|
|
|
// Named keys above maintained for backwards compatibility
|
|
|
|
// Ideally only Gitlabs is used
|
|
|
|
GitlabHost string `yaml:"gitlabHost,omitempty" json:"gitlabHost,omitempty"`
|
|
|
|
GitlabToken string `yaml:"gitlabToken,omitempty" json:"gitlabToken,omitempty"`
|
|
|
|
Gitlabs []GitlabConfig `yaml:"gitlabs" json:"gitlabs"`
|
2024-01-16 16:15:52 +00:00
|
|
|
Giteas []GiteaConfig `yaml:"giteas" json:"giteas"`
|
2024-01-17 13:13:58 +00:00
|
|
|
Remotes []info.RemoteInfo
|
|
|
|
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 {
|
2024-01-14 15:33:15 +00:00
|
|
|
Full bool `yaml:"full" json:"full"`
|
|
|
|
} `yaml:"dump" json:"dump"`
|
|
|
|
Editor editorConfig `yaml:"editor" json:"editor"`
|
|
|
|
}
|
|
|
|
|
2024-01-16 16:15:52 +00:00
|
|
|
type GiteaConfig struct {
|
2024-01-17 13:13:58 +00:00
|
|
|
Host string `yaml:"host" json:"host"`
|
|
|
|
Name string `yaml:"name" json:"name"`
|
|
|
|
Token string `yaml:"token" json:"token"`
|
|
|
|
CloneProto info.CloneProto `yaml:"cloneProto" json:"cloneProto"`
|
2024-01-16 16:15:52 +00:00
|
|
|
}
|
|
|
|
|
2024-01-14 15:33:15 +00:00
|
|
|
type GitlabConfig struct {
|
2024-01-17 13:13:58 +00:00
|
|
|
Host string `yaml:"host" json:"host"`
|
|
|
|
Name string `yaml:"name" json:"name"`
|
|
|
|
Token string `yaml:"token" json:"token"`
|
|
|
|
CloneProto info.CloneProto `yaml:"cloneProto" json:"cloneProto"`
|
2023-12-05 21:56:47 +00:00
|
|
|
}
|
|
|
|
|
2023-12-12 21:30:33 +00:00
|
|
|
type editorConfig struct {
|
2023-12-29 15:24:12 +00:00
|
|
|
DisplayName string `yaml:"displanName,omitempty" json:"displanName,omitempty"`
|
|
|
|
Binary string `yaml:"binary,omitempty" json:"binary,omitempty"`
|
|
|
|
OpenFlags string `yaml:"openFlags,omitempty" json:"openFlags,omitempty"`
|
2023-12-29 13:55:06 +00:00
|
|
|
OpenDirectory bool `yaml:"openDirectory" json:"openDirectory" description:"Don't open well-known files, open directory"`
|
2023-12-12 21:30:33 +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-29 15:24:12 +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"`
|
|
|
|
Unlock struct {
|
|
|
|
Force bool `yaml:"force" json:"force"`
|
|
|
|
} `yaml:"unlock" json:"unlock"`
|
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{
|
|
|
|
LogLevel: "warn",
|
|
|
|
ProjectPath: "~/work/projects",
|
2024-01-14 15:33:15 +00:00
|
|
|
Gitlabs: []GitlabConfig{{
|
2024-01-16 17:48:42 +00:00
|
|
|
Host: "https://gitlab.com",
|
|
|
|
Token: "yourtokenhere",
|
2024-01-17 13:13:58 +00:00
|
|
|
CloneProto: info.CloneProtoSSH,
|
2024-01-16 17:48:42 +00:00
|
|
|
Name: "GitLab",
|
2024-01-14 15:33:15 +00:00
|
|
|
}},
|
2023-12-10 15:10:46 +00:00
|
|
|
Cache: cacheConfig{
|
|
|
|
Ttl: 168 * time.Hour,
|
|
|
|
Load: loadConfig{
|
|
|
|
OwnerOnly: true,
|
|
|
|
},
|
|
|
|
},
|
2023-12-05 21:56:47 +00:00
|
|
|
}
|