config

package
v0.0.0-...-3462b3d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2020 License: BSD-3-Clause, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Static       string
	IP           string
	Port         string
	ReadTimeout  int
	WriteTimeout int
	StopTimeout  int
	IdleTimeout  int
	Prod         bool
}

Config manages the configuration options of the program. All members are unexported, accessed solely through member methods

func Build

func Build() *Config

Build uses `flag` package to build and return config struct.

func New

func New() *Config

New construct and returns a config with default values, for use in testing server. Static dir defaults to dev value, Build() will overwrite with cwd

func (Config) Get404

func (c Config) Get404() string

Get404 returns the filename of the 404 page

func (Config) GetAddress

func (c Config) GetAddress() string

GetAddress returns the address:port of the server and port to listen on

func (Config) GetIdleTimeout

func (c Config) GetIdleTimeout() time.Duration

GetIdleTimeout returns the time.Duration of the idle timeout

func (Config) GetIndexHTML

func (c Config) GetIndexHTML() string

GetIndexHTML returns the filename of the html page

func (Config) GetLivenessCheckInterval

func (c Config) GetLivenessCheckInterval() (time.Duration, error)

GetLivenessCheckInterval returns the interval on which to conduct liveness checks in production, uses socket to get httpd.service watchdog interval from systemd daemon

func (Config) GetReadTimeout

func (c Config) GetReadTimeout() time.Duration

GetReadTimeout returns the time.Duration of the read timeout

func (Config) GetStopTimeout

func (c Config) GetStopTimeout() time.Duration

GetStopTimeout returns the time.Duration of the stop timeout

func (Config) GetWriteTimeout

func (c Config) GetWriteTimeout() time.Duration

GetWriteTimeout returns the time.Duration of the write timeout

func (Config) IsProd

func (c Config) IsProd() bool

IsProd returns bool representing whether program executing in dev mode

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL