Implémenter client web de base
Déplacer tous les flags vers rootCmd.PersistentFlags() Ajouter config struct types à models/ Ajouter data/apiclient.go#ApiClient.GetHealth() Ajouter webCmd avec viper.Unmarshal() pour valeurs de config Ajouter package web depuis agecem/bottin
This commit is contained in:
parent
7773b3cf72
commit
c850b221a1
8 changed files with 431 additions and 56 deletions
|
@ -17,3 +17,44 @@ type Transaction struct {
|
|||
GivenAt *time.Time `db:"given_at" json:"given_at"`
|
||||
IsPerpetual bool `db:"is_perpetual" json:"is_perpetual"`
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
Web WebConfig `json:"web"`
|
||||
Api ApiConfig `json:"api"`
|
||||
Bottin BottinConfig `json:"bottin"`
|
||||
Db DbConfig `json:"db"`
|
||||
}
|
||||
|
||||
type ApiConfig struct {
|
||||
Key string `json:"key"`
|
||||
Port int `json:"port"`
|
||||
}
|
||||
|
||||
type BottinConfig struct {
|
||||
Api struct {
|
||||
Host string `json:"host"`
|
||||
Key string `json:"key"`
|
||||
Protocol string `json:"protocol"`
|
||||
Port int `json:"port"`
|
||||
} `json:"api"`
|
||||
}
|
||||
|
||||
type DbConfig struct {
|
||||
Database string `json:"database"`
|
||||
Host string `json:"host"`
|
||||
Password string `json:"password"`
|
||||
Port int `json:"port"`
|
||||
User string `json:"user"`
|
||||
}
|
||||
|
||||
type WebConfig struct {
|
||||
Api struct {
|
||||
Host string `json:"host"`
|
||||
Key string `json:"key"`
|
||||
Port int `json:"port"`
|
||||
Protocol string `json:"protocol"`
|
||||
} `json:"api"`
|
||||
Password string `json:"password"`
|
||||
Port int `json:"port"`
|
||||
User string `json:"user"`
|
||||
}
|
||||
|
|
Reference in a new issue