configuration

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2018 License: Apache-2.0 Imports: 14 Imported by: 47

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PluginsDir string

PluginsDir absolute path to service plugins directory

View Source
var WorkDir string

WorkDir absolute path to service working directory

Functions

func ConfigureLog added in v0.0.4

func ConfigureLog() error

func ConfigureLoggers added in v0.1.0

func ConfigureLoggers(c *LogConfig) error

func GetHumanLogger added in v0.0.4

func GetHumanLogger() *zap.SugaredLogger

GetHumanLogger return production logger

func GetLogger

func GetLogger() *zap.SugaredLogger

GetLogger return production logger

func LoadPlugins added in v0.0.4

func LoadPlugins(path string, list []string) map[string]PluginState

LoadPlugins load plugins from path

Types

type AuthConfig added in v0.0.4

type AuthConfig struct {
	Anonymous bool     `yaml:"anonymous,omitempty" default:"false"`
	Order     []string `yaml:"order"`
}

type Config added in v0.0.4

type Config struct {
	System    SystemConfig    `yaml:"system"`
	Plugins   PluginsConfig   `yaml:"plugins,omitempty"`
	Mqtt      MqttConfig      `yaml:"mqtt,omitempty"`
	Listeners ListenersConfig `yaml:"listeners,omitempty"`
	Security  SecurityConfig  `yaml:"security,omitempty"`
	Auth      AuthConfig      `yaml:"auth,omitempty"`
}

Config system-wide config

func DefaultConfig added in v0.0.4

func DefaultConfig() *Config

DefaultConfig Load minimum working configuration to allow server start without user provided one

func ReadConfig added in v0.0.4

func ReadConfig() *Config

ReadConfig read service configuration

type ConsoleLogConfig added in v0.0.4

type ConsoleLogConfig struct {
	LogConfigBase `yaml:",inline"`
}

ConsoleLogConfig entry in system.log.console

type FileLogConfig added in v0.0.4

type FileLogConfig struct {
	LogConfigBase `yaml:",inline"`
	File          string `yaml:"file,omitempty"`
	MaxSize       int    `yaml:"maxSize,omitempty"`
	MaxBackups    int    `yaml:"maxBackups,omitempty"`
	MaxAge        int    `yaml:"maxAge,omitempty"`
}

FileLogConfig entry in system.log.file

type ListenersConfig added in v0.0.4

type ListenersConfig struct {
	DefaultAddr string                           `yaml:"defaultAddr,omitempty"`
	MQTT        map[string]map[string]PortConfig `yaml:"mqtt,omitempty"`
}

ListenersConfig

type LogConfig added in v0.0.4

type LogConfig struct {
	Console ConsoleLogConfig `yaml:"console"`
	SysLog  *SysLogConfig    `yaml:"syslog,omitempty"`
	File    *FileLogConfig   `yaml:"file,omitempty"`
}

LogConfig entry in system.log

type LogConfigBase added in v0.1.0

type LogConfigBase struct {
	Timestamp *struct {
		Format string `yaml:"format" default:"2006-01-02T15:04:05Z07:00"`
	} `yaml:"timestamp,omitempty"`
	Level     string `yaml:"level"`
	Backtrace bool   `yaml:"backtrace"`
}

LogConfigBase base entry for all logger

func (*LogConfigBase) UnmarshalYAML added in v0.1.0

func (s *LogConfigBase) UnmarshalYAML(unmarshal func(interface{}) error) error

type MqttConfig added in v0.0.4

type MqttConfig struct {
	Version []string `yaml:"version,omitempty"`
	Systree struct {
		Enabled        bool `yaml:"enabled,omitempty"`
		UpdateInterval int  `yaml:"updateInterval,omitempty"`
	} `yaml:"systree,omitempty"`
	KeepAlive struct {
		Period int  `yaml:"period,omitempty"`
		Force  bool `yaml:"force,omitempty"`
	} `yaml:"keepAlive,omitempty"`
	Options struct {
		ConnectTimeout  int           `yaml:"connectTimeout,omitempty"`
		SessionDups     bool          `yaml:"sessionDups,omitempty"`
		RetainAvailable bool          `yaml:"retainAvailable,omitempty"`
		SubsOverlap     bool          `yaml:"subsOverlap,omitempty"`
		SubsID          bool          `yaml:"subsId,omitempty"`
		SubsShared      bool          `yaml:"subsShared,omitempty"`
		SubsWildcard    bool          `yaml:"subsWildcard,omitempty"`
		ReceiveMax      uint16        `yaml:"receiveMax,omitempty"`
		MaxPacketSize   uint32        `yaml:"maxPacketSize,omitempty"`
		MaxTopicAlias   uint16        `yaml:"maxTopicAlias,omitempty"`
		MaxQoS          mqttp.QosType `yaml:"maxQoS,omitempty"`
		OfflineQoS0     bool          `yaml:"offlineQoS0,omitempty"`
	}
}

MqttConfig server config

type Options

type Options struct {
	// LogWithTs either display timestamp messages on log or not
	LogWithTs bool
}

Options global MQTT config

type PluginState added in v0.0.4

type PluginState struct {
	Plugin vlplugin.Plugin
	Errors []error
}

PluginState status

type PluginsConfig added in v0.0.4

type PluginsConfig struct {
	Enabled []string               `yaml:"enabled,omitempty"`
	Config  map[string]interface{} `yaml:"config,omitempty"`
}

PluginsConfig entry in system.plugins

type PortConfig added in v0.0.4

type PortConfig struct {
	Host string     `yaml:"host,omitempty"`
	Auth AuthConfig `yaml:"auth"`
	TLS  TLSConfig  `yaml:"tls,omitempty"`
	Path string     `yaml:"path,omitempty"`
}

PortConfig configuration of tcp/ssl/ws(s) listeners

type SecurityConfig added in v0.0.4

type SecurityConfig struct {
	TLS TLSConfig `yaml:"tls,omitempty"`
}

SecurityConfig system security config

type SysLogConfig added in v0.0.4

type SysLogConfig struct {
	LogConfigBase `yaml:",inline"`
}

SysLogConfig entry in system.log.syslog

type SystemConfig added in v0.0.4

type SystemConfig struct {
	Log  LogConfig `yaml:"log"`
	Http struct {
		DefaultPort string `yaml:"defaultPort"`
	} `yaml:"http"`
}

SystemConfig entry in system

type TLSConfig added in v0.0.4

type TLSConfig struct {
	Cert string `yaml:"cert,omitempty"`
	Key  string `yaml:"key,omitempty"`
}

TLSConfig used by SecurityConfig or ssl/ws listeners

func (*TLSConfig) LoadConfig added in v0.0.4

func (t *TLSConfig) LoadConfig() (*tls.Config, error)

func (*TLSConfig) Validate added in v0.0.4

func (t *TLSConfig) Validate() (tls.Certificate, error)

Jump to

Keyboard shortcuts

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