mirror of
https://github.com/Slug-Boi/cocommit.git
synced 2026-05-13 12:45:47 +00:00
refactor: add env var for config location
This commit is contained in:
@@ -15,6 +15,7 @@ var ConfigVar *Config
|
|||||||
var (
|
var (
|
||||||
defaultConfigLocations = []string{
|
defaultConfigLocations = []string{
|
||||||
"",
|
"",
|
||||||
|
os.Getenv("COCOMMIT_CONFIG"),
|
||||||
os.Getenv("HOME") + "/.config/cocommit",
|
os.Getenv("HOME") + "/.config/cocommit",
|
||||||
os.Getenv("HOME") + "/cocommit",
|
os.Getenv("HOME") + "/cocommit",
|
||||||
"/etc/cocommit",
|
"/etc/cocommit",
|
||||||
@@ -40,6 +41,8 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func LoadConfig() (*Config, error) {
|
func LoadConfig() (*Config, error) {
|
||||||
|
// TODO: create if and give param as default config location
|
||||||
|
|
||||||
v := viper.New()
|
v := viper.New()
|
||||||
v.SetConfigName(configName)
|
v.SetConfigName(configName)
|
||||||
v.SetConfigType(configType)
|
v.SetConfigType(configType)
|
||||||
|
|||||||
Reference in New Issue
Block a user