refactor: add env var for config location

This commit is contained in:
Slug-Boi
2025-06-03 17:28:37 +02:00
parent eac0e43023
commit 45d4c6e8b4
+3
View File
@@ -15,6 +15,7 @@ var ConfigVar *Config
var (
defaultConfigLocations = []string{
"",
os.Getenv("COCOMMIT_CONFIG"),
os.Getenv("HOME") + "/.config/cocommit",
os.Getenv("HOME") + "/cocommit",
"/etc/cocommit",
@@ -40,6 +41,8 @@ func init() {
}
func LoadConfig() (*Config, error) {
// TODO: create if and give param as default config location
v := viper.New()
v.SetConfigName(configName)
v.SetConfigType(configType)