func initConfig() {
	if cfgFile != "" {  
		viper.SetConfigFile(cfgFile)
	}
	viper.SetConfigName(".ostent")  
	viper.AddConfigPath("$HOME")    
	viper.AutomaticEnv()            
	viper.SetConfigFile(cfgFile)  
	if err := viper.ReadInConfig(); err == nil {
	}
}
initConfig reads in config file and ENV variables if set.
package cmd
import (
	"fmt"
	"os"
	"github.com/spf13/cobra"
	"github.com/spf13/viper"
)
var cfgFile string
var RootCmd = &cobra.Command{
	SilenceUsage: true,
	Use:          "ostent",
	Short:        "Ostent is a metrics tool.",
	Long:         "Ostent is a server tool to collect, display and report system metrics.",
	PersistentPostRunE: persistentPostRuns.runE,
	PersistentPreRunE:  persistentPreRuns.runE,
}
func Execute() {
	if err := RootCmd.Execute(); err != nil {
		fmt.Println(err)
		os.Exit(-1)
	}
}
func init() {
	cobra.OnInitialize(initConfig)
	RootCmd.Flags().StringVar(&cfgFile, "config", "", "config filename (default \"$HOME/.ostent.toml\")")
	initFlags()
}