agecem-org/config.go

41 lines
1.3 KiB
Go

package main
/*
Permet de contenir la configuration obtenue par cobra/viper
Example d'utilisation sans error handling:
```
var cfg config.Config
viper.Unmarshal(&cfg)
```
`cfg` devrait alors contenir la configuration, et les données peuvent être
obtenues simplement en utilisant la dot (.) notation
*/
type Config struct {
Server struct {
Admin struct {
Auth bool `mapstructure:"auth"`
Password string `mapstructure:"password"`
Username string `mapstructure:"username"`
} `mapstructure:"admin"`
Api struct {
Auth bool `mapstructure:"auth"`
Host string `mapstructure:"host"`
Key string `mapstructure:"key"`
Port int `mapstructure:"port"`
Protocol string `mapstructure:"protocol"`
} `mapstructure:"api"`
Documents struct {
AccessKeyId string `mapstructure:"access_key_id"`
Buckets map[string]string `mapstructure:"buckets"`
Endpoint string `mapstructure:"endpoint"`
SecretAccessKey string `mapstructure:"secret_access_key"`
UseSSL bool `mapstructure:"use_ssl"`
KeyId string `mapstructure:"keyid"`
KeyValue string `mapstructure:"keyvalue"`
} `mapstructure:"documents"`
Port int `mapstructure:"port"`
} `mapstructure:"server"`
}