config

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2020 License: MIT Imports: 0 Imported by: 6

Documentation

Overview

Package config defines standard interfaces for a config reader/writer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReadOption

type ReadOption func(o *ReadOptions)

ReadOption is a helper setting ReadOptions.

func WithFile added in v0.0.3

func WithFile(f string) ReadOption

WithFile is an option allow the reader read configuration from a file.

func WithPrefix

func WithPrefix(prefix string) ReadOption

WithPrefix return a with prefix reader option.

type ReadOptions

type ReadOptions struct {
	Prefix string
	File   string
}

ReadOptions contains available options of Reader interface.

func (*ReadOptions) Apply

func (op *ReadOptions) Apply(opts ...ReadOption)

Apply applies the given option.

type Reader

type Reader interface {
	// Read read the configuration into the given struct (ptr).
	// The provided struct should be a pointer.
	Read(ptr interface{}, options ...ReadOption) error

	// Close close the underlying source.
	Close() error
}

Reader is a configuration loader.

Directories

Path Synopsis
Package envconfig provides a convenient way to load config from environment variables into a struct using https://github.com/kelseyhightower/envconfig.
Package envconfig provides a convenient way to load config from environment variables into a struct using https://github.com/kelseyhightower/envconfig.

Jump to

Keyboard shortcuts

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