Documentation
¶
Index ¶
- Constants
- func ConfigureLogging(config *LoggingConfig) (hclog.Logger, error)
- func CreateDistributedLock(config *mongoConf) (*lock.Client, error)
- func DecodeToml(file string, val interface{}) error
- func EncodeToml(val interface{}) ([]byte, error)
- func ParseJsonFile(f string, val interface{}) error
- type Config
- type ConfigConnection
- type ConfigSnmp
- type Configuration
- type DispatcherConf
- type LockConf
- type LoggingConfig
- type MongoServerEntry
- type NatsServerEntry
- type PollerConf
Constants ¶
View Source
const ( DefaultExt = ".conf" DefaultPath = "./" )
View Source
const (
DefaultLockTTL = time.Second * 90
)
Variables ¶
This section is empty.
Functions ¶
func ConfigureLogging ¶
func ConfigureLogging(config *LoggingConfig) (hclog.Logger, error)
ConfigureLogging will take the logging configuration and also adds a few default parameters
func CreateDistributedLock ¶
CreateDistributedLock creates the the lock
func DecodeToml ¶
func EncodeToml ¶
func ParseJsonFile ¶
Types ¶
type Config ¶
func (*Config) WatchConfig ¶
func (c *Config) WatchConfig()
type ConfigConnection ¶
type ConfigConnection struct { Type string `json:"type" hcl:",label"` User string `json:"username" hcl:"username"` Password string `json:"password" hcl:"password"` Port int `json:"port" hcl:"port"` ScreenLength string `json:"screen_length" hcl:"screen_length,optional"` RegexPrompt string `json:"default_prompt" hcl:"default_prompt"` Errors string `json:"default_errors" hcl:"default_errors"` CacheTTL string `json:"cache_ttl" hcl:"cache_ttl,optional"` ReadDeadLine string `json:"read_dead_line" hcl:"read_dead_line,optional"` WriteDeadLine string `json:"write_dead_line" hcl:"write_dead_line,optional"` SSHKeyPath string `json:"ssh_key_path" hcl:"ssh_key_path,optional"` }
func (ConfigConnection) CastToConnection ¶
func (c ConfigConnection) CastToConnection() (*connection.Config, error)
type ConfigSnmp ¶
type ConfigSnmp struct { StringVersion string `json:"stringVersion" hcl:",label"` Community string `json:"community" hcl:"community"` Version uint8 `json:"version" hcl:"version,optional"` Port uint16 `json:"port" hcl:"port"` Timeout string `json:"timeout" hcl:"timeout"` Retries int `json:"retries" hcl:"retries"` MaxIterations int `json:"max_iterations" hcl:"max_iterations,optional"` MaxRepetitions int `json:"max_repetitions" hcl:"max_repetitions,optional"` NonRepeaters int `json:"non_repeaters" hcl:"non_repeaters,optional"` DynamicRepetitions bool `json:"dynamic_repetitions" hcl:"dynamic_repetitions,optional"` }
func (ConfigSnmp) CastToSNMPC ¶
func (c ConfigSnmp) CastToSNMPC() (*snmpc.C, error)
type Configuration ¶
type Configuration struct { // Default Group string `json:"group" hcl:"group"` NatsServers []*NatsServerEntry `json:"nats_servers" hcl:"nats_server,block"` ReceiverQueues []string `json:"receiver_queues" hcl:"receiver_queues"` ResponseGroup string `json:"response_group" hcl:"response_group"` LogConfig *LoggingConfig `json:"logging" hcl:"logging,block"` RPCPort int `json:"rpc_port" hcl:"rpc_port"` // Poller Poller *PollerConf `json:"poller" hcl:"poller,block"` // Dispatcher Dispatcher *DispatcherConf `json:"dispatcher" hcl:"dispatcher,block"` MongoConf *mongoConf `json:"mongo" hcl:"mongo,block"` LockConf *LockConf `json:"distributed_lock" hcl:"distributed_lock,block"` }
Configuration is the place to store your config for this app.
func DefaultConfig ¶
func DefaultConfig() *Configuration
DefaultConfig returns a default configuration
func LoadConfig ¶
func LoadConfig(cmd *cobra.Command) (*Configuration, error)
func (Configuration) GetServers ¶
func (c Configuration) GetServers() (string, error)
GetServers parses the NatsServerEntries and returns a []string with servers server:port, server:port ...
type DispatcherConf ¶
type LockConf ¶
type LoggingConfig ¶
type LoggingConfig struct { Level string `hcl:"level,optional"` File string `hcl:"file,optional"` Json bool `hcl:"as_json,optional"` }
LoggingConfig specifies all the parameters needed for logging
type MongoServerEntry ¶
type NatsServerEntry ¶
NatsServer
type PollerConf ¶
type PollerConf struct { MessageCache int `json:"message_cache" hcl:"message_cache"` NoWorkers int `json:"workers" hcl:"workers"` Snmp []*ConfigSnmp `json:"snmp" hcl:"snmp,block"` Connection []*ConfigConnection `json:"connection" hcl:"connection,block"` }
Click to show internal directories.
Click to hide internal directories.