config

package
v0.0.0-...-7dc6c5b Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2018 License: MIT Imports: 5 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(inputLoader *viper.Viper) bool

Load loads all configurations from yaml files.

func LoadEnv

func LoadEnv(inputLoader *viper.Viper, inputAppConfig *AppConfig) bool

LoadEnv loads environments to overide config file.

func Merge

func Merge(inputLoader *viper.Viper) bool

Merge combines config files.

func NewLoader

func NewLoader() *viper.Viper

NewLoader creates new loader.

func Watch

func Watch(inputLoader *viper.Viper, inputAppConfig *AppConfig) bool

Watch watches changes from config files and reload.

Types

type AppConfig

type AppConfig struct {
	Mode   string
	Web    *WebConfig
	Log    *LogConfig
	Loader *LoaderConfig
}

AppConfig is the app configuration.

func Default

func Default() *AppConfig

Default returns the default app configuration.

func New

func New() *AppConfig

New reates new app configuration.

type CorsConfig

type CorsConfig struct {
	Enable bool
}

CorsConfig is the cors configuration.

type GzipConfig

type GzipConfig struct {
	Enable bool
}

GzipConfig is the gzip configuration.

type LoaderConfig

type LoaderConfig struct {
	EnableEnv   bool
	EnableWatch bool
}

LoaderConfig is the loader configuration.

type LogConfig

type LogConfig struct {
	Level      string
	EnableFile bool
	FilePath   string
}

LogConfig is the log configuration.

type MiddlewareConfig

type MiddlewareConfig struct {
	Cors   *CorsConfig
	Gzip   *GzipConfig
	Static *StaticConfig
}

MiddlewareConfig is the middleware configuration.

type StaticConfig

type StaticConfig struct {
	Enable bool
}

StaticConfig is the static configuration.

type WebConfig

type WebConfig struct {
	ServerAddress string
	StaticPath    string
	Middleware    *MiddlewareConfig
}

WebConfig is the web configuration.

Jump to

Keyboard shortcuts

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