Add multi-remote support for GitLab (#1)

Co-authored-by: Ryan D McGuire <ryand_mcguire@sweetwater.com>
Reviewed-on: 50W/git-project-manager#1
This commit is contained in:
2024-01-14 15:33:15 +00:00
parent 415290de20
commit b944af140a
27 changed files with 868 additions and 422 deletions

View File

@ -3,15 +3,24 @@ package config
import "time"
type Config struct {
Editor editorConfig `yaml:"editor" json:"editor"`
GitlabHost string `yaml:"gitlabHost" json:"gitlabHost"`
GitlabToken string `yaml:"gitlabToken,omitempty" json:"gitlabToken,omitempty"`
LogLevel string `yaml:"logLevel" json:"logLevel" enum:"info,warn,debug,error"`
ProjectPath string `yaml:"projectPath" json:"projectPath"`
Cache cacheConfig `yaml:"cache" json:"cache"`
// 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"`
LogLevel string `yaml:"logLevel" json:"logLevel" enum:"info,warn,debug,error"`
ProjectPath string `yaml:"projectPath" json:"projectPath"`
Cache cacheConfig `yaml:"cache" json:"cache"`
Dump struct {
Full bool
}
Full bool `yaml:"full" json:"full"`
} `yaml:"dump" json:"dump"`
Editor editorConfig `yaml:"editor" json:"editor"`
}
type GitlabConfig struct {
Host string `yaml:"host" json:"host"`
Name string `yaml:"name" json:"name"`
Token string `yaml:"token" json:"token"`
}
type editorConfig struct {
@ -38,10 +47,13 @@ type cacheConfig struct {
}
var DefaultConfig = Config{
GitlabHost: "https://gitlab.com",
GitlabToken: "yourtokenhere",
LogLevel: "warn",
ProjectPath: "~/work/projects",
Gitlabs: []GitlabConfig{{
Host: "https://gitlab.com",
Token: "yourtokenhere",
Name: "GitLab",
}},
Cache: cacheConfig{
Ttl: 168 * time.Hour,
Load: loadConfig{