config

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2018 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindConfigFile

func FindConfigFile() string

func NewEmptyLogger

func NewEmptyLogger() *verbose.Logger

func NewLogger

func NewLogger(c *Config, name string) *verbose.Logger

Types

type Config

type Config struct {
	Logging    *LoggingConfig
	Database   *DatabaseConfig
	Leases     *LeasesConfig
	Server     *ServerConfig
	Management *ManagementConfig
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(configFile string) (conf *Config, err error)

func NewEmptyConfig

func NewEmptyConfig() *Config

type DatabaseConfig

type DatabaseConfig struct {
	Type     string
	Path     string
	Username string
	Password string
	Protocol string
	Address  string
	Port     int
	Name     string

	LeaseTable     string
	DeviceTable    string
	BlacklistTable string
}

type Environment

type Environment struct {
	Config *Config
	Env    EnvironmentEnv
	Log    *verbose.Logger
	// contains filtered or unexported fields
}

Environment holds "global" application information such as a database connection, logging, the config, sessions, etc.

func NewEnvironment

func NewEnvironment(t EnvironmentEnv) *Environment

func NewTestEnvironment

func NewTestEnvironment() *Environment

func (*Environment) IsDev

func (e *Environment) IsDev() bool

func (*Environment) IsProd

func (e *Environment) IsProd() bool

func (*Environment) IsTesting

func (e *Environment) IsTesting() bool

func (*Environment) SubscribeShutdown

func (e *Environment) SubscribeShutdown() <-chan bool

type EnvironmentEnv

type EnvironmentEnv string
const (
	EnvTesting EnvironmentEnv = "testing"
	EnvProd    EnvironmentEnv = "production"
	EnvDev     EnvironmentEnv = "development"
)

type LeasesConfig

type LeasesConfig struct {
	DeleteAfter string // TODO: Run a job to clean up old leases
}

type LoggingConfig

type LoggingConfig struct {
	Disabled bool
	Level    string
	Path     string
}

type ManagementConfig

type ManagementConfig struct {
	Address    string
	Port       int
	AllowedIPs []string
}

type ServerConfig

type ServerConfig struct {
	BlockBlacklisted bool
	NetworksFile     string
	Workers          int
}

Jump to

Keyboard shortcuts

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