config

package
v0.0.0-...-c825c05 Latest Latest
Warning

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

Go to latest
Published: May 27, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PRODUCTION     = "production"
	DEVELOPMENT    = "development"
	STAGING        = "staging"
	DEFAULT_CONSUL = "consul"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {

	// Env is a reference to our environment configuration object
	Env *Env
	// contains filtered or unexported fields
}

Config describes our global application configuration element. This structure will wrap any local or remote Viper clients that may be used to retrieve configuration objects from remote service providers such as etcd or Consul.

The struct should also be composed with any additional configuration struct that you define in your application, e.g. "*Env"

func Init

func Init() *Config

func (*Config) IsDebugEnvironment

func (a *Config) IsDebugEnvironment() bool

IsDebugEnvironment returns true if the application is in debug mode

func (*Config) IsDevelopment

func (a *Config) IsDevelopment() bool

IsDevelopment returns whether the application is in dev mode

func (*Config) IsProduction

func (a *Config) IsProduction() bool

IsProduction returns true if the application is running in a production environment

func (*Config) IsStaging

func (a *Config) IsStaging() bool

IsStaging returns true if the application is running in a staging environment

func (*Config) LogLevel

func (a *Config) LogLevel() logger.LogLevel

LogLevel returns the current the application logger level

type Env

type Env struct {
	// ApplicationEnvironment provides production, development, or staging environment specification
	ApplicationEnvironment string `mapstructure:"app_env"`

	// ApplicationToken is the JWT signing token used to compare incoming authentication requests with the auth middleware
	ApplicationToken string `mapstructure:"token"`

	// Debug flags whether the application is running in debugging mode or not (increased log verbosity, no "pm", etc)
	Debug bool `mapstructure:"debug"`

	// HTTPHost defines the hostname that the HTTP server will listen on e.g. localhost for development
	HTTPHost string `mapstructure:"http_host"`

	// HTTPPort defines the port that the HTTP server will listen on e.g. 80
	HTTPPort string `mapstructure:"http_port"`

	// LogPath is the storage path for Herbert/Monolog style log output
	LogPath string `mapstructure:"log_path"`

	// LogChannel defines the channel this application's logs will be tagged with. Within our "golang" app channel
	// we have defined channels by service. This value may be "gokit-base" for this project.
	LogChannel string `mapstructure:"channel"`
}

Env describes the gokit-base environment configuration. For this app, these values represent JSON data stored in Consul.

Jump to

Keyboard shortcuts

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