feat: add vault module

This commit is contained in:
Prad Nukala
2024-09-25 19:49:16 -04:00
parent 94f1a7e581
commit 607af1e76d
354 changed files with 22222 additions and 20921 deletions
+31
View File
@@ -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
}