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")
|
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"))
|
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
|
// 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)")
|
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"))
|
viper.BindPFlag("server.admin.auth", serverCmd.Flags().Lookup("server-admin-auth"))
|
||||||
|
|
|
@ -22,7 +22,10 @@ type Config struct {
|
||||||
} `mapstructure:"admin"`
|
} `mapstructure:"admin"`
|
||||||
Api struct {
|
Api struct {
|
||||||
Auth bool `mapstructure:"auth"`
|
Auth bool `mapstructure:"auth"`
|
||||||
|
Host string `mapstructure:"host"`
|
||||||
Key string `mapstructure:"key"`
|
Key string `mapstructure:"key"`
|
||||||
|
Port int `mapstructure:"port"`
|
||||||
|
Protocol string `mapstructure:"protocol"`
|
||||||
} `mapstructure:"api"`
|
} `mapstructure:"api"`
|
||||||
Documents struct {
|
Documents struct {
|
||||||
AccessKeyId string `mapstructure:"access_key_id"`
|
AccessKeyId string `mapstructure:"access_key_id"`
|
||||||
|
|
Loading…
Reference in a new issue