Add ~/.config/lume/lume.conf to configuration file search paths

This commit is contained in:
Ryan Cavicchioni 2021-03-31 00:19:03 -05:00
parent f0cf3e12b6
commit 100b585663
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D

View File

@ -11,6 +11,7 @@ import (
) )
const lumercFile string = ".lumerc" const lumercFile string = ".lumerc"
const lumeConfigFile string = "lume.conf"
type Config struct { type Config struct {
AccessToken string `toml:"access_token"` AccessToken string `toml:"access_token"`
@ -122,6 +123,15 @@ func getConfigPath() string {
} }
} }
// ~/.config/lume/lume.conf
homeDir, err = os.UserHomeDir()
if err == nil {
tryPath = path.Join(homeDir, ".config/lume", lumeConfigFile)
if _, err := os.Stat(tryPath); !os.IsNotExist(err) {
configPath = tryPath
}
}
// ./.lumerc // ./.lumerc
cwd, err = os.Getwd() cwd, err = os.Getwd()
if err == nil { if err == nil {