config

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2017 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadFromFile

func ReadFromFile(cnfPath string) ([]byte, error)

ReadFromFile reads data from a file

func Refresh

func Refresh(newCnf *Config)

Refresh sets config through the pointer so config actually gets refreshed

func Reset

func Reset()

Reset sets configLoaded back to false

Types

type AMQPConfig

type AMQPConfig struct {
	Exchange         string           `yaml:"exchange" envconfig:"AMQP_EXCHANGE"`
	ExchangeType     string           `yaml:"exchange_type" envconfig:"AMQP_EXCHANGE_TYPE"`
	QueueBindingArgs QueueBindingArgs `yaml:"queue_binding_args" envconfig:"AMQP_QUEUE_BINDING_ARGS"`
	BindingKey       string           `yaml:"binding_key" envconfig:"AMQP_BINDING_KEY"`
	PrefetchCount    int              `yaml:"prefetch_count" envconfig:"AMQP_PREFETCH_COUNT"`
}

AMQPConfig wraps RabbitMQ related configuration

type Config

type Config struct {
	Broker          string      `yaml:"broker" envconfig:"BROKER"`
	DefaultQueue    string      `yaml:"default_queue" envconfig:"DEFAULT_QUEUE"`
	ResultBackend   string      `yaml:"result_backend" envconfig:"RESULT_BACKEND"`
	ResultsExpireIn int         `yaml:"results_expire_in" envconfig:"RESULTS_EXPIRE_IN"`
	AMQP            *AMQPConfig `yaml:"amqp"`
	TLSConfig       *tls.Config
}

Config holds all configuration for our program

func Get

func Get() *Config

Get returns internally stored configuration

func NewFromEnvironment

func NewFromEnvironment(mustLoadOnce, keepReloading bool) *Config

NewFromEnvironment creates a config object from environment variables

func NewFromYaml

func NewFromYaml(cnfPath string, mustLoadOnce, keepReloading bool) *Config

NewFromYaml creates a config object from YAML file

type QueueBindingArgs

type QueueBindingArgs map[string]interface{}

QueueBindingArgs arguments which are used when binding to the exchange

func (*QueueBindingArgs) Decode

func (args *QueueBindingArgs) Decode(value string) error

Decode from yaml to map (any field whose type or pointer-to-type implements envconfig.Decoder can control its own deserialization)

Jump to

Keyboard shortcuts

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