Skip to content

Commit

Permalink
feat: support VALE_CONFIG_PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkato committed Jul 4, 2023
1 parent 27fe2f6 commit cc59245
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/core/ini.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ func loadINI(cfg *Config, dry bool) error {
}
}

fromEnv, hasEnv := os.LookupEnv("VALE_CONFIG_PATH")
if cfg.Flags.Sources != "" {
// We have multiple sources -- e.g., local config + remote package(s).
//
Expand All @@ -194,6 +195,13 @@ func loadINI(cfg *Config, dry bool) error {
return NewE100("invalid --config", err)
}
cfg.Root = filepath.Dir(cfg.Flags.Path)
} else if hasEnv {
// We've been given a value through `VALE_CONFIG_PATH`.
uCfg, err = shadowLoad(fromEnv)
if err != nil {
return NewE100("invalid VALE_CONFIG_PATH", err)
}
cfg.Root = filepath.Dir(fromEnv)
} else {
// We're using a config file found using a local search process.
uCfg, err = shadowLoad(base)
Expand Down

0 comments on commit cc59245

Please sign in to comment.