func ParseConfig() (*cfg.Config, error) {
	conf := cfg.DefaultConfig()
	err := viper.Unmarshal(conf)
	if err != nil {
		return nil, err
	}
	conf.SetRoot(conf.RootDir)
	cfg.EnsureRoot(conf.RootDir)
	if err := conf.ValidateBasic(); err != nil {
		return nil, fmt.Errorf("error in config file: %v", err)
	}
	return conf, nil
}
ParseConfig retrieves the default environment configuration,
sets up the Ostracon root and ensures that the root exists
package commands
import (
	"fmt"
	"os"
	"strings"
	"github.com/spf13/cobra"
	"github.com/spf13/viper"
	cfg "github.com/line/ostracon/config"
	"github.com/line/ostracon/libs/cli"
	tmflags "github.com/line/ostracon/libs/cli/flags"
	"github.com/line/ostracon/libs/log"
)
var (
	config = cfg.DefaultConfig()
	logger = log.NewOCLogger(log.NewSyncWriter(os.Stdout))
)
func init() {
	registerFlagsRootCmd(RootCmd)
}
func registerFlagsRootCmd(cmd *cobra.Command) {
	cmd.PersistentFlags().String("log_level", config.LogLevel, "log level")
}