func SetDefaults(runtime string, conf *viper.Viper) *viper.Viper {
	conf.SetDefault("environment", "development")
	conf.SetDefault("runtime", runtime)
	conf.SetDefault("genesis_file", path.Join(runtime, "genesis.json"))
	conf.SetDefault("moniker", "anonymous")
	conf.SetDefault("p2p_laddr", "tcp://0.0.0.0:46656")
	conf.SetDefault("seeds", "")
	conf.SetDefault("auth_by_ca", false)               
	conf.SetDefault("non_validator_auth_by_ca", true)  
	conf.SetDefault("fast_sync", true)
	conf.SetDefault("skip_upnp", true)
	conf.SetDefault("addrbook_file", path.Join(runtime, "addrbook.json"))
	conf.SetDefault("addrbook_strict", false)  
	conf.SetDefault("pex_reactor", true)       
	conf.SetDefault("priv_validator_file", path.Join(runtime, "priv_validator.json"))
	conf.SetDefault("db_backend", "leveldb")
	conf.SetDefault("db_dir", path.Join(runtime, DATADIR))
	conf.SetDefault("db_archive_dir", path.Join(runtime, ARCHIVEDIR))
	conf.SetDefault("revision_file", path.Join(runtime, "revision"))
	conf.SetDefault("filter_peers", false)
	conf.SetDefault("signbyCA", "")  
	conf.SetDefault("log_path", "")
	conf.SetDefault("threshold_blocks", 900)
	conf.SetDefault("enable_incentive", false)
	setMempoolDefaults(conf)
	setConsensusDefaults(conf)
	return conf
}
SetDefaults sets all the default configs for angine
package config
import (
	"os"
	"path"
	"strings"
	homedir "github.com/mitchellh/go-homedir"
	"github.com/pkg/errors"
	"github.com/spf13/viper"
	cmn "github.com/Baptist-Publication/chorus-module/lib/go-common"
)
const (
	RUNTIME_ENV = "ANGINE_RUNTIME"
	DEFAULT_RUNTIME = ".angine"
	DATADIR    = "data"
	ARCHIVEDIR = "archive"
	CONFIGFILE = "config.toml"
)
var runtimePath string
func parseConfigTpl(moniker string, root string) (conf string) {
	conf = strings.Replace(CONFIGTPL, "__MONIKER__", moniker, -1)
	return
}
func RuntimeDir(root string) string {
	if root != "" {
		return root
	}
	if len(runtimePath) == 0 {
		runtimePath = os.Getenv(RUNTIME_ENV)
		if len(runtimePath) == 0 {
			runtimePath, _ = homedir.Dir()
		}
		runtimePath = path.Join(runtimePath, DEFAULT_RUNTIME)
	}
	return runtimePath
}
func InitRuntime(root string) {
	cmn.EnsureDir(root, 0700)
	cmn.EnsureDir(path.Join(root, DATADIR), 0700)
	configFilePath := path.Join(root, CONFIGFILE)
	if !cmn.FileExists(configFilePath) {
		cmn.MustWriteFile(configFilePath, []byte(parseConfigTpl("anonymous", root)), 0644)
	}
}
func GetConfig(root string) (conf *viper.Viper) {
	var err error
	runtime := RuntimeDir(root)
	InitRuntime(runtime)
	conf = viper.New()
	conf.SetEnvPrefix("ANGINE")
	conf.SetConfigFile(path.Join(runtime, CONFIGFILE))
	if err = conf.ReadInConfig(); err != nil {
		cmn.Exit(errors.Wrap(err, "angine configuration").Error())
	}
	if conf.IsSet("chain_id") {
		cmn.Exit("Cannot set 'chain_id' via config.toml")
	}
	if conf.IsSet("revision_file") {
		cmn.Exit("Cannot set 'revision_file' via config.toml. It must match what's in the Makefile")
	}
	SetDefaults(runtime, conf)
	return
}