package conf

import (
	"github.com/jinzhu/configor"
)

type mysqlSetting struct {
	User     string `yaml:"user"`
	Password string `yaml:"password"`
	Host     string `yaml:"host"`
	DB       string `yaml:"db"`
}

type Conf struct {
	Mysql          mysqlSetting `yaml:"mysql"`
	KeyManagerAddr string       `yaml:"keymanageraddr"`
	EthRpcAddrs    []string     `json:"ethrpcaddrs"`
	TronRpcAddrs   []string     `json:"tronrpcaddrs"`
}

var conf Conf

func InitConfig(path string) error {
	err := configor.Load(&conf, path)
	if err != nil {
		return err
	}

	return nil
}

func GetConfig() Conf {
	return conf
}
