Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultHeaders ¶
func DefaultHeaders(w http.ResponseWriter)
func DefaultLogger ¶
DefaultLogger builds a default logrus logger
Pre-Condition: - None Post-Condition: - None Params: - None Returns: - logrus entry as a logger Errors: - None Dev Notes: - None
Types ¶
type Config ¶
Config contains settings and configurations support various server integrations. Implements pkg.Config
func (Config) String ¶
String provides a string representation of the state of this struct
Pre-Condition: - None Post-Condition: - None Params: - None Returns: - string representation Errors: - None Dev Notes: - None
func (Config) Validate ¶
Validate verifys that - required config attributes are set - attributes that are provided have valid values
Pre-Condition: - None Post-Condition: - None Params: - None Returns: - true if valid configs provided, otherwise false Errors: - if Config is not initialized - if one or more errors are detected Dev Notes: - None
type Options ¶
type Options struct { HasProfiling bool HasPush bool CertFile string KeyFile string Timeout int } //of Options
Options contains feature switches to support various server integrations. This implements pkg.Options
func (*Options) LoadDefaults ¶
func (o *Options) LoadDefaults()
LoadDefaults loads any default option values
Pre-Condition: - Options are initialized Post-Condition: - Sets HashPush feature flag based on presense and finding cert and key files Params: - None Returns: - None Errors: - None Dev Notes: - The HasPush feature flag is Read Only. The cert and key files must be valid before it toggles to true
func (Options) String ¶
String provides a string representation of the state of this struct
Pre-Condition: - None Post-Condition: - None Params: - None Returns: - string representation Errors: - None Dev Notes: - None
func (Options) Validate ¶
Validate verifys that - required option attributes are set - attributes that are provided have valid values
Pre-Condition: - None Post-Condition: - None Params: - None Returns: - true if valid options provided, otherwise false Errors: - if one or more errors are detected Dev Notes: - None
type Server ¶
Server provides http(s) support to this application. Set options for feature flags and Configs for env/system configurations
func NewServer ¶
NewServer initializes a new server based on options and configs provided
Pre-Condition: - None Post-Condition: - None Params: - opts Options or feature flags supported for this server - conf Config or required settings for this server Returns: - instance of server - errors if any Errors: - invalid port provided Dev Notes: - None
func (*Server) RegisterHandler ¶
RegisterHandler allow clients to register new routes/paths
Pre-Condition: - Server is initialized - Server has valid options - Server has valid configs Post-Condition: - router has new path with associated Handler Params: - path string subpath for this route - handler Handler that will apply logic for request and associated response Returns: - None Errors: - None Dev Notes: - None
func (Server) Run ¶
Run Starts the server with routes based on the provided configurations and options. If cert and key info is provided in options, the server will start as an TLS (Push) server.
Pre-Condition: - Server is initialized - Server has valid options - Server has valid configs Post-Condition: - server is running and able to accept requests Params: - None Returns: - Error Errors: - if certs/TLS is indicated but not found - if errors while starting TLS server support - if errors while starting non-TLS server support Dev Notes: - None