config

package
v0.0.0-...-148dfbe Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WorkerInfoServer uwe.WorkerName = "info-server"
	WorkerAPIServer  uwe.WorkerName = "api-server"
	WorkerDBKeeper   uwe.WorkerName = "db-keeper"
	WorkerFooBar     uwe.WorkerName = "foobar"
)
View Source
const ServiceName = "service-scaffold"

TODO: change me

Variables

View Source
var AvailableWorkers = map[uwe.WorkerName]struct{}{
	WorkerInfoServer: {},
	WorkerDBKeeper:   {},
	WorkerAPIServer:  {},
	WorkerFooBar:     {},
}

Functions

func Init

func Init(path string)

Types

type Cfg

type Cfg struct {
	Api     api.Config   `json:"api" yaml:"api"`
	DB      DBCfg        `json:"db" yaml:"db"`           // DB is a database connection string.
	CouchDB string       `json:"couchdb" yaml:"couchdb"` // CouchDB is a couchdb url connection string.
	NATS    natsx.Config `json:"nats" yaml:"nats"`
	Log     log.Config   `json:"log" yaml:"log"`

	DevMode             bool `json:"dev_mode" yaml:"dev_mode"`
	ServicesInitTimeout int  `json:"servicesInitTimeout" yaml:"services_init_timeout"`

	// Workers is a list of workers
	// that must be started, start all if empty.
	Workers []uwe.WorkerName `yaml:"workers"`
}

Cfg main structure of the app configuration.

func Config

func Config() *Cfg

Config returns the config obj.

func (Cfg) FillDefaultWorkers

func (cfg Cfg) FillDefaultWorkers()

func (Cfg) Validate

func (cfg Cfg) Validate() error

type DBCfg

type DBCfg struct {
	ConnURL     string `json:"conn_url" yaml:"conn_url"` //The database connection string.
	InitTimeout int    `json:"dbInitTimeout" yaml:"init_timeout"`
	// AutoMigrate if `true` execute db migrate up on start.
	AutoMigrate bool `json:"auto_migrate" yaml:"auto_migrate"`
	WaitForDB   bool `json:"wait_for_db" yaml:"wait_for_db"`
}

func (DBCfg) Validate

func (cfg DBCfg) Validate() error

type WorkerExistRule

type WorkerExistRule struct {
	AvailableWorkers map[uwe.WorkerName]struct{}
	// contains filtered or unexported fields
}

func (*WorkerExistRule) Error

func (r *WorkerExistRule) Error(message string) *WorkerExistRule

Error sets the error message for the rule.

func (*WorkerExistRule) Validate

func (r *WorkerExistRule) Validate(value interface{}) error

Validate checks that service exist on the system

Jump to

Keyboard shortcuts

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