config

package
v0.0.5 Latest Latest
Warning

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

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

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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