config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: BSD-3-Clause Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name string
	Dirs []string
	// contains filtered or unexported fields
}

Config holds the common information for options: name and directories from where to load values.

func New

func New(name string, dirs ...string) (c *Config)

New creates a new instance of Config.

func (*Config) Load

func (c *Config) Load() (err error)

Load reads configuration values from json and yaml files in config directories, and also from environment variables.

func (*Config) Register

func (c *Config) Register(name string, o Options)

Register adds new Options to the Config.

func (*Config) String

func (c *Config) String() string

String returns the YAML-encoded multi document representation of current configuration state.

func (*Config) VerifyAndPrepare

func (c *Config) VerifyAndPrepare() error

VerifyAndPrepare executes the same named method on options in config.

type Options

type Options interface {
	VerifyAndPrepare() error
}

Options defines methods that are required for options.

Jump to

Keyboard shortcuts

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