diff --git a/cmd/server.go b/cmd/server.go index 770d970..68b2b3b 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -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")) diff --git a/config/config.go b/config/config.go index decfeca..d2d637a 100644 --- a/config/config.go +++ b/config/config.go @@ -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"`