exchange/config.go

32 lines
568 B
Go
Raw Normal View History

2024-06-25 16:59:56 +00:00
package exchange
import "github.com/spf13/viper"
type Config interface {
Get(string) interface{}
GetBool(string) bool
GetInt(string) int
GetString(string) string
UnmarshalKey(string, interface{}) error
}
type ExchangeConfig struct {
Name string
ApiKey string
SecretKey string
Passphrase string
IsTest bool
}
func WrapViper(cfg *viper.Viper) Config {
return &ViperCfg{Viper: cfg}
}
type ViperCfg struct {
*viper.Viper
}
func (c *ViperCfg) UnmarshalKey(key string, rawVal interface{}) error {
return c.Viper.UnmarshalKey(key, rawVal)
}