func (c *Config) Reload() error {
	if err := c.viper.ReadInConfig(); err != nil {
		return err
	}
	if err := c.validate(); err != nil {
		return err
	}
	c.Debug = c.viper.GetBool("debug")
	c.PluginLocations = c.viper.GetStringSlice("plugin.locations")
	c.PolicyStoreName = c.viper.GetString("policy.store_name")
	c.PolicyStoreParams = c.viper.GetStringMapString("policy.store_params")
	c.PolicyEngineName = c.viper.GetString("policy.engine_name")
	c.PolicyEngineParams = c.viper.GetStringMapString("policy.engine_params")
	c.EndorsementStoreName = c.viper.GetString("endorsements.store_name")
	c.EndorsementStoreParams = c.viper.GetStringMap("endorsements.store_params")
	return nil
}
Reload re-runs configuration discovery based on config paths currently set,
and repo-poulates the config with discovered values.
package common
import (
	"fmt"
	"github.com/spf13/viper"
)
var DefaultConfigPaths = []string{
	"$HOME/veraison",
	".",
}
var expectedConfigKey = []string{
	"plugin.locations",
	"policy.store_name",
	"policy.engine_name",
	"endorsements.store_name",
}
type Config struct {
	Debug bool
	PluginLocations []string
	PolicyStoreName string
	PolicyEngineName string
	EndorsementStoreName string
	PolicyStoreParams PolicyStoreParams
	PolicyEngineParams PolicyEngineParams
	EndorsementStoreParams EndorsementStoreParams
	viper *viper.Viper
}
func NewConfig() *Config {
	config := &Config{}
	config.Init(DefaultConfigPaths)
	return config
}
func (c *Config) Init(paths []string) {
	c.viper = viper.New()
	c.viper.SetConfigName("config.yaml")
	c.viper.SetConfigType("yaml")
	for _, path := range paths {
		c.viper.AddConfigPath(path)
	}
}
func (c Config) AddPath(path string) {
	c.viper.AddConfigPath(path)
}
func (c Config) SetFileName(name string) {
	c.viper.SetConfigName(name)
}