func initConfig() {
	if cfgFile != "" {  
		viper.SetConfigFile(cfgFile)
	}
	viper.SetConfigName("vaultfs")         
	viper.AddConfigPath("/etc/sysconfig")  
	viper.AddConfigPath("$HOME")           
	viper.AutomaticEnv()                   
	if err := viper.ReadInConfig(); err == nil {
		logrus.WithField("config", viper.ConfigFileUsed()).Info("using config file from disk")
	}
}
initConfig reads in config file and ENV variables if set.
package cmd
import (
	"os"
	"github.com/Sirupsen/logrus"
	"github.com/spf13/cobra"
	"github.com/spf13/viper"
)
var cfgFile string
var RootCmd = &cobra.Command{
	Use:   "vaultfs",
	Short: "use Docker's volumes to mount Vault secrets",
	Long:  `use Docker's volumes to mount Vault secrets`,
}
func Execute() {
	if err := RootCmd.Execute(); err != nil {
		logrus.WithError(err).Error("error executing command")
		os.Exit(-1)
	}
}
func init() {
	cobra.OnInitialize(initConfig, initLogging, lockMemory)
	RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is /etc/sysconfig/vaultfs)")
	RootCmd.PersistentFlags().String("log-level", "info", "log level (one of fatal, error, warn, info, or debug)")
	RootCmd.PersistentFlags().String("log-format", "text", "log level (one of text or json)")
	RootCmd.PersistentFlags().String("log-destination", "stdout:", "log destination (file:/your/output, stdout:, journald:, or syslog://tag@host:port#protocol)")
	if err := viper.BindPFlags(RootCmd.PersistentFlags()); err != nil {
		logrus.WithError(err).Fatal("could not bind flags")
	}
}