Allow special configuration file "/dev/null"
authorMikael Berthe <mikael@lilotux.net>
Fri, 12 May 2017 00:09:04 +0200
changeset 125 d436b88d137b
parent 124 20d514540f37
child 126 7d712d2bde73
Allow special configuration file "/dev/null"
cmd/root.go
--- a/cmd/root.go	Thu May 11 23:57:17 2017 +0200
+++ b/cmd/root.go	Fri May 12 00:09:04 2017 +0200
@@ -169,6 +169,9 @@
 
 // initConfig reads in config file and ENV variables if set.
 func initConfig() {
+	if cfgFile == "/dev/null" {
+		return
+	}
 	if cfgFile != "" { // enable ability to specify config file via flag
 		viper.SetConfigFile(cfgFile)
 	}