diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-10-04 22:05:39 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-10-10 00:23:01 +1100 |
commit | 485f6d53864845d2e58b63b04dd83e3dcc2b4e6a (patch) | |
tree | fa8b56d7bc13c8676bf1ca04c2bdcce77c48367f /pkg/config | |
parent | 778ca8e6f9f012de401fef215270670d1e028545 (diff) |
support configurable config
Diffstat (limited to 'pkg/config')
-rw-r--r-- | pkg/config/app_config.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go index 95ac99b73..df4707a94 100644 --- a/pkg/config/app_config.go +++ b/pkg/config/app_config.go @@ -81,6 +81,11 @@ func NewAppConfig(name, version, commit, date string, buildSource string, debugg } func ConfigDir() string { + envConfigDir := os.Getenv("CONFIG_DIR") + if envConfigDir != "" { + return envConfigDir + } + // chucking my name there is not for vanity purposes, the xdg spec (and that // function) requires a vendor name. May as well line up with github configDirs := xdg.New("jesseduffield", "lazygit") @@ -226,7 +231,7 @@ func loadAppState() (*AppState, error) { } appStateBytes, err := ioutil.ReadFile(filepath) - if err != nil { + if err != nil && !os.IsNotExist(err) { return nil, err } |