config

package
v0.0.0-...-6fc17c5 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2017 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigSchema = `` /* 3217-byte string literal not displayed */

Generated at http://jsonschema.net/#/

View Source
const DEFAULT_FILENAME = "config.json"

Variables

This section is empty.

Functions

func Validate

func Validate(file []byte) error

Types

type BackendConfig

type BackendConfig struct {
	Name      string `json:"name"`
	Address   string `json:"address"`
	Heartbeat string `json:"heartbeat"`
	HBMethod  string `json:"hbmethod"`

	ActiveAfter   int `json:"activeAfter"`
	InactiveAfter int `json:"inactiveAfter"` // Consider inactive after max inactiveAfter
	Weight        int `json:"weigth"`

	HeartbeatTime time.Duration `json:"heartbeatTime"` // Heartbeat time if health
	RetryTime     time.Duration `json:"retryTime"`     // Retry to time after failed
}

BackendConfig it's the configuration loaded

type BackendsConfig

type BackendsConfig []BackendConfig

type Configuration

type Configuration struct {
	GeneralConfig   `json:"general"`
	FrontendsConfig `json:"frontends"`
}

func ConfParser

func ConfParser(file []byte) Configuration

ConfParser to Parse JSON FILE

func Setup

func Setup(filename string) Configuration

Setup will build everything and let the server run

type FrontendConfig

type FrontendConfig struct {
	Name           string        `json:"name"`
	Host           string        `json:"host"`
	Port           int           `json:"port"`
	Route          string        `json:"route"`
	Timeout        time.Duration `json:"timeout"`
	BackendsConfig `json:"backends"`
}

type FrontendsConfig

type FrontendsConfig []FrontendConfig

type GeneralConfig

type GeneralConfig struct {
	MaxProcs         int    `json:"maxProcs"`
	WorkerPoolSize   int    `json:"workerPoolSize"`
	GracefulShutdown bool   `json:"gracefulShutdown"`
	Websocket        bool   `json:"websocket"`
	LogLevel         string `json:"logLevel"` // Need to define how it works
	RPCHost          string `json:"rpchost"`
	RPCPort          int    `json:"rpcport"`
	APIHost          string `json:"apihost"`
	APIPort          int    `json:"apiport"`
}

func (GeneralConfig) APIAddres

func (c GeneralConfig) APIAddres() string

func (GeneralConfig) RPCAddres

func (c GeneralConfig) RPCAddres() string

Jump to

Keyboard shortcuts

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