git-project-manager/pkg/manager/manager_config.go
2023-12-04 16:53:01 -05:00

30 lines
744 B
Go

package manager
import (
"os"
"time"
"golang.org/x/exp/slog"
)
const (
managerDefCacheFile = "/tmp/gitlab_project-manager_cache"
managerDefConfigFile = "~/.config/project-manager/config.yaml"
managerDefProjectsPath = "~/work/projects"
)
type ManagerConfig struct {
CacheTTL time.Duration `yaml:"cacheTTL" json:"cacheTTL" default:"48h"`
CacheFile string `yaml:"cacheFile" json:"cacheFile"`
ConfigFile string `yaml:"configFile" json:"configFile"`
ProjectsPath string `yaml:"projectsPath" json:"projectsPath"`
}
func NewConfigFromFile(file string) *ManagerConfig {
_, err := os.Open(file)
if err != nil {
slog.Warn("Skipping config file, can't read", "err", err)
}
return &ManagerConfig{}
}