config

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2019 License: Apache-2.0 Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	// Get an optional setting by name, with a default value to return if it does
	// exist.
	Optional(key string, defaultValue string) string

	// Get a required setting by name.
	Required(key string) (string, error)
}

Interface for fetching configuration settings

type DefaultConfig

type DefaultConfig struct {
}

The default configuration implementation simply fetches a setting from an environment variable.

func (*DefaultConfig) Optional

func (d *DefaultConfig) Optional(key string, defaultValue string) string

func (*DefaultConfig) Required

func (d *DefaultConfig) Required(key string) (string, error)

type FakeConfig

type FakeConfig struct {
	// contains filtered or unexported fields
}

func NewFakeConfig

func NewFakeConfig() *FakeConfig

func (*FakeConfig) Optional

func (t *FakeConfig) Optional(key string, defaultValue string) string

func (*FakeConfig) Required

func (t *FakeConfig) Required(key string) (string, error)

func (*FakeConfig) Set

func (t *FakeConfig) Set(key string, value string)

Jump to

Keyboard shortcuts

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