Ajouter api.NewApiClientFromViper() et flags manquants associés #70
2 changed files with 17 additions and 2 deletions
|
@ -110,6 +110,18 @@ func init() {
|
|||
serverCmd.Flags().String("server-api-key", "agecem-org", "Key to use for authenticating to /v1 routes")
|
||||
viper.BindPFlag("server.api.key", serverCmd.Flags().Lookup("server-api-key"))
|
||||
|
||||
// server.api.port
|
||||
serverCmd.Flags().Int("server-api-port", 8080, "API server port (config: server.api.port)")
|
||||
viper.BindPFlag("server.api.port", serverCmd.Flags().Lookup("server-api-port"))
|
||||
|
||||
// server.api.protocol
|
||||
serverCmd.Flags().String("server-api-protocol", "http", "API server protocol (http/https) (config: server.api.protocol)")
|
||||
viper.BindPFlag("server.api.protocol", serverCmd.Flags().Lookup("server-api-protocol"))
|
||||
|
||||
// server.api.host
|
||||
serverCmd.Flags().String("server-api-host", "localhost", "API server host (config: server.api.host)")
|
||||
viper.BindPFlag("server.api.host", serverCmd.Flags().Lookup("server-api-host"))
|
||||
|
||||
// server.admin.auth - --server-admin-auth
|
||||
serverCmd.Flags().Bool("server-admin-auth", true, "Enable to allow basic authentication for /admin routes (config: server.admin.auth)")
|
||||
viper.BindPFlag("server.admin.auth", serverCmd.Flags().Lookup("server-admin-auth"))
|
||||
|
|
|
@ -21,8 +21,11 @@ type Config struct {
|
|||
Username string `mapstructure:"username"`
|
||||
} `mapstructure:"admin"`
|
||||
Api struct {
|
||||
Auth bool `mapstructure:"auth"`
|
||||
Key string `mapstructure:"key"`
|
||||
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"`
|
||||
|
|
Loading…
Reference in a new issue