hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit b7fd410245ed47a46176735ddc1f292a03bb51fe
parent 0743c76795d4a652dea1b9ac9995b2710573457b
Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date:   Mon, 18 Apr 2016 18:37:32 +0200

commands: Support config from ENV

So

```bash
env HUGO_TITLE="Some Title" hugo server
```

Will change the `title`.

Fixes #2090

Diffstat:
Mcommands/hugo.go | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/commands/hugo.go b/commands/hugo.go
@@ -17,7 +17,6 @@ package commands
 
 import (
 	"fmt"
-	"github.com/spf13/hugo/hugofs"
 	"io/ioutil"
 	"net/http"
 	"os"
@@ -27,6 +26,8 @@ import (
 	"sync"
 	"time"
 
+	"github.com/spf13/hugo/hugofs"
+
 	"github.com/spf13/hugo/parser"
 	flag "github.com/spf13/pflag"
 
@@ -318,6 +319,8 @@ func loadDefaultSettings() {
 // A Hugo command that calls initCoreCommonFlags() can pass itself
 // as an argument to have its command-line flags processed here.
 func InitializeConfig(subCmdVs ...*cobra.Command) error {
+	viper.AutomaticEnv()
+	viper.SetEnvPrefix("hugo")
 	viper.SetConfigFile(cfgFile)
 	// See https://github.com/spf13/viper/issues/73#issuecomment-126970794
 	if source == "" {