Documentation
¶
Index ¶
Constants ¶
View Source
const ( ErrAddressEmpty string = "address is empty" ErrPortEmpty string = "port is empty" ErrPortBadf string = "port is a non-integer: %s" ErrShutdownTimeoutBadf string = "shutdown timeout is lte to 0: %v" )
View Source
const ( EnvNameAddress string = "BLUDGEON_REST_ADDRESS" EnvNamePort string = "BLUDGEON_REST_PORT" EnvNameShutdownTimeout string = "BLUDGEON_REST_SHUTDOWN_TIMEOUT" EnvNameAllowCredentials string = "BLUDGEON_ALLOW_CREDENTIALS" EnvNameAllowedOrigins string = "BLUDGEON_ALLOWED_ORIGINS" EnvNameAllowedMethods string = "BLUDGEON_ALLOWED_METHODS" EnvNameCorsDebug string = "BLUDGEON_CORS_DEBUG" EnvNameCorsDisabled string = "BLUDGEON_DISABLE_CORS" )
View Source
const ( DefaultAddress string = "127.0.0.1" DefaultPort string = "8080" DefaultShutdownTimeout time.Duration = 10 * time.Second DefaultAllowCredentials bool = true DefaultCorsDebug bool = false )
View Source
const ( ErrStarted string = "already started" ErrNotStarted string = "not started" )
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New() interface { internal.Configurer internal.Initializer internal.Parameterizer context.Context }
Types ¶
type Configuration ¶
type Configuration struct { Address string `json:"address"` Port string `json:"port"` Timeout time.Duration `json:"timeout"` ShutdownTimeout time.Duration `json:"shutdown_timeout"` AllowedOrigins []string `json:"allowed_origins"` AllowedMethods []string `json:"allowed_methods"` AllowCredentials bool `json:"allow_credentials"` CorsDebug bool `json:"cors_debug"` CorsDisabled bool `json:"cors_disabled"` }
func (*Configuration) FromEnv ¶
func (c *Configuration) FromEnv(envs map[string]string)
func (*Configuration) Validate ¶
func (c *Configuration) Validate() (err error)
type HandleFuncConfig ¶
type RouteBuilder ¶ added in v1.4.0
type RouteBuilder interface {
BuildRoutes() []HandleFuncConfig
}
Click to show internal directories.
Click to hide internal directories.