config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2020 License: MIT Imports: 7 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 {
	Addr       string  `env:"ADDR" envDefault:"0.0.0.0:8080"`
	ConfigPath string  `env:"CONFIG_PATH"`
	ConfigURL  url.URL `env:"CONFIG_URL"`
}

Config stores configuration parameters for interacting with the server at a global level. This can include listening address, feature flags and other configurations.

func New

func New() (Config, error)

New initializes a Config, attempting to parse parames from Envs.

func (*Config) Load added in v0.1.0

func (c *Config) Load() (io.Reader, error)

Load attempts to fetch a Router configuration from one of the optional locations (URL or Filepath). On success it returns an io.Reader for this file otherwise an error is returned.

type ErrUndefinedConfig added in v0.1.0

type ErrUndefinedConfig struct{}

ErrUndefinedConfig represents a route configuration hasn't been specified.

func (*ErrUndefinedConfig) Error added in v0.1.0

func (e *ErrUndefinedConfig) Error() string

Jump to

Keyboard shortcuts

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