mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
feat: add vault module
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package proxy
|
||||
|
||||
import "github.com/spf13/viper"
|
||||
|
||||
type Config struct {
|
||||
Host string `mapstructure:"HOST"`
|
||||
Port string `mapstructure:"PORT"`
|
||||
SSL bool `mapstructure:"SSL"`
|
||||
CertFile string `mapstructure:"CERT_FILE"`
|
||||
KeyFile string `mapstructure:"KEY_FILE"`
|
||||
}
|
||||
|
||||
func (c *Config) GetHostname() string {
|
||||
return c.Host + ":" + c.Port
|
||||
}
|
||||
|
||||
func LoadConfig(path string) (config Config, err error) {
|
||||
viper.AddConfigPath(path)
|
||||
viper.SetConfigName("app")
|
||||
viper.SetConfigType("env")
|
||||
|
||||
viper.AutomaticEnv()
|
||||
|
||||
err = viper.ReadInConfig()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = viper.Unmarshal(&config)
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user