config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2017 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package config loads the configurations from a yaml file. Configurations come in the following form:

app:
  log_level: info
writers:
  elasticsearch:
     url: http://localhost:9200
     index: logs
  file:
     path: /var/log/logpipe/logs.log

The app part will be collapsed as the Setting properties.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrFileNotExist is returned when the file can not be read.
	ErrFileNotExist = errors.New("file does not exist")

	// ErrNoWriters is returned when there is no writes found on the settings.
	ErrNoWriters = errors.New("no writers found")
)

Functions

This section is empty.

Types

type Setting

type Setting struct {

	// LogLevel is the level in which the logpipe application writes it's own
	// logs.
	LogLevel string

	// Writers has a map of "writer" name to its configuration.
	// Each writer decides its own configuration.
	// It goes as: [name:[type:file, location:foo, name:bar]],..
	Writers map[string]map[string]string
}

Setting holds the required configuration settings for bootstrapping the application.

func Read

func Read(filename string) (*Setting, error)

Read loads the configurations from filename location. The filename should be a valid yaml file or it will return an error. It will return an error if there is no writers defined.

Jump to

Keyboard shortcuts

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