Documentation ¶
Index ¶
Constants ¶
View Source
const ( EnvAddress = "HTTP_ADDRESS" EnvPort = "HTTP_PORT" )
Variables ¶
Functions ¶
func ProvideHttpConfigs ¶
func ProvideHttpConfigs(typ qsconfig.ConfigType[*HttpConfigs]) fx.Option
Validate, then provide the app with an HTTP server. This is required if you need to use custom routers such as Gin and Chi
To use this:
var Module = fx.Options( qshttp.ProvideHttpConfigs(&qshttp.EnvConfigType{}) )
this code will provide a new default instance of a qshttp.HttpConfigs that can be used to instantiate a http.Server.
in case you want to customize a qshttp.HttpConfig yourself, implements:
qsconfig.ConfigType[*HttpConfigs]
If you need custom dependencies, don't use this, instead, create a fx.Option yourself:
fx.Provide(func (dep *Dependencies) (*qshttp.HttpConfigs, error) { // Do something return &qshttp.HttpConfigs{ // Options here } })
Types ¶
type EnvConfigType ¶
type EnvConfigType struct{}
Requires these following environment variables
- HTTP_ADDRESS: Optional, if empty, it defaults to localhost or 127.0.0.1
- HTTP_PORT: Required, the TCP port for the HTTP server to attach and listen to
func (*EnvConfigType) Config ¶
func (t *EnvConfigType) Config() (*HttpConfigs, error)
Click to show internal directories.
Click to hide internal directories.