Open pedromotita opened 4 months ago
Instead of calling config from the CLI layer, create a dedicated package. Viper would be wrapped in this package, and would not appear anywhere in the code, all config management would be done by the config package.
It's API could look something like:
type PorkbunAPIConfig struct { Key string `json:"key"` SecretKey string `json:"secretKey"` Domain string `json:"domain"` Subdomain string `json:"subdomain"` Type string `json:"type"` } type Config struct{} func (c *Config) Get() (PorkbunAPIConfig, error) func (c *Config) GetKey(key string) (PorkbunAPIConfig, error) func (c *Config) Set(key, value string) error func (c *Config) Delete(key) error
I think it's a great refactor from what we have now, great suggestion!
Description
Instead of calling config from the CLI layer, create a dedicated package. Viper would be wrapped in this package, and would not appear anywhere in the code, all config management would be done by the config package.
It's API could look something like: