config

package
v0.0.0-...-bc5e729 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2017 License: MPL-2.0 Imports: 7 Imported by: 8

README

config

config for configuration management using configor.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config = struct {
	Env  Env `default:"develop" env:"ONCEKV_ENV"`
	Root string

	HTTPRequestTimeout    time.Duration `default:"100000000" default:"ONCEKV_HTTP_REQUEST_TIMEOUT"`
	IdealResponseDuration time.Duration `default:"50000000" default:"ONCEKV_HTTP_IDEAL_RESPONSE_DURATION"`

	// etcd addrs and the the meta data key
	EtcdEndpoints []string `default:"['127.0.0.1:2379']" env:"ONCEKV_ETCD_ADDRS"`
	RaftKey       string   `default:"oncekv.nodes.http.adrr" env:"ONCEKV_DB_NODE_KEY"`

	RaftNodesKey  string `default:"oncekv.db.nodes" env:"ONCEKV_DB_NODES_KEY"`
	CacheNodesKey string `default:"oncekv.cache.nodes" env:"ONCEKV_CACHE_NODES_KEY"`

	// db shard master
	ShardCount int `default:"10" env:"ONCEKV_SHARD_COUNT"`

	// cache server
	CacheMasterAddr string `default:"127.0.0.1:5550" env:"ONCEKV_CACHE_MASTER_ADDR"`
	// default is 10M
	CacheBytes int64 `default:"10485760" env:"ONCEKV_CACHE_BYTES"`

	// admin
	AdminAddr string `default:"127.0.0.1:5546" env:"ONCEKV_ADMIN_ADDR"`

	// TODO: choose log collector
	LogOut io.Writer
}{}

Config for config

View Source
var ErrDataNotFound = errors.New("data not found")

ErrDataNotFound for error data not found

Functions

func Root

func Root() string

Root returns the root path of oncekv

Types

type Env

type Env string

Env for application environment

func (Env) IsDevelop

func (e Env) IsDevelop() bool

IsDevelop returns if the env equals to develop

func (Env) IsProduction

func (e Env) IsProduction() bool

IsProduction returns if the env equals to production

func (Env) IsTest

func (e Env) IsTest() bool

IsTest returns if the env equals to develop

Jump to

Keyboard shortcuts

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