package config import ( "os" "go.uber.org/zap" "gopkg.in/yaml.v3" ) type Config struct { Gitea struct { URL string `yaml:"url"` ApiKey string `yaml:"api_key"` } `yaml:"gitea"` Users struct { DefaultPassword string `yaml:"default_password"` CSVPath string `yaml:"csv_path"` } `yaml:"users"` Organizations struct { CSVPath string `yaml:"csv_path"` } `yaml:"organizations"` Issues struct { CSVPath string `yaml:"csv_path"` } `yaml:"issues"` Collaborators struct { CSVPath string `yaml:"csv_path"` } `yaml:"collaborators"` } func LoadConfig(path string) (*Config, error) { data, err := os.ReadFile(path) if err != nil { return nil, err } var config Config if err := yaml.Unmarshal(data, &config); err != nil { return nil, err } return &config, nil } func NewZapCfg(dev bool) zap.Config { prodConfig := zap.NewProductionConfig() if dev { prodConfig = zap.NewDevelopmentConfig() } return prodConfig }