Ajouter config.Config pour viper.Unmarshal()
This commit is contained in:
parent
9ff3f0430d
commit
64c91b3aeb
1 changed files with 36 additions and 0 deletions
36
config/config.go
Normal file
36
config/config.go
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
package config
|
||||||
|
|
||||||
|
/*
|
||||||
|
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 `json:"auth"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
Username string `json:"username"`
|
||||||
|
} `json:"admin"`
|
||||||
|
Api struct {
|
||||||
|
Auth bool `json:"auth"`
|
||||||
|
Key string `json:"key"`
|
||||||
|
} `json:"api"`
|
||||||
|
Documents struct {
|
||||||
|
AccessKeyId string `json:"access_key_id"`
|
||||||
|
Buckets []string `json:"buckets"`
|
||||||
|
Endpoint string `json:"endpoint"`
|
||||||
|
SecretAccessKey string `json:"secret_access_key"`
|
||||||
|
UseSSL bool `json:"use_ssl"`
|
||||||
|
} `json:"documents"`
|
||||||
|
Port int `json:"port"`
|
||||||
|
} `json:"server"`
|
||||||
|
}
|
Loading…
Reference in a new issue