mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
parent
d392893cd7
commit
31fb29fb3f
3 changed files with 11 additions and 2 deletions
|
@ -303,7 +303,6 @@ func (c *commandeer) loadConfig(mustHaveConfigFile, running bool) error {
|
|||
WorkingDir: dir,
|
||||
Filename: c.h.cfgFile,
|
||||
AbsConfigDir: c.h.getConfigDir(dir),
|
||||
Environ: os.Environ(),
|
||||
Environment: environment,
|
||||
},
|
||||
cfgSetAndInit,
|
||||
|
|
|
@ -141,3 +141,13 @@ func GetDependencyList() []string {
|
|||
|
||||
return deps
|
||||
}
|
||||
|
||||
// IsRunningAsTest reports whether we are running as a test.
|
||||
func IsRunningAsTest() bool {
|
||||
for _, arg := range os.Args {
|
||||
if strings.HasPrefix(arg, "-test") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ func LoadConfig(d ConfigSourceDescriptor, doWithConfig ...func(cfg config.Provid
|
|||
d.Environment = hugo.EnvironmentProduction
|
||||
}
|
||||
|
||||
if len(d.Environ) == 0 {
|
||||
if len(d.Environ) == 0 && !hugo.IsRunningAsTest() {
|
||||
d.Environ = os.Environ()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue