config

package
v0.0.0-...-a2d18c2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2022 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Overview

Package config defines a manager to manage common configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager is the configuration manager.

func New

func New(name string) *Manager

New returns a new initialized manager with the given config.

func (*Manager) AddConfigFlag

func (mgr *Manager) AddConfigFlag(persistentFlags *pflag.FlagSet)

AddConfigFlag adds the config flag to the persistent root flagset.

func (*Manager) Flags

func (mgr *Manager) Flags() *pflag.FlagSet

Flags returns pflag.FlagSet.

func (*Manager) InitFlags

func (mgr *Manager) InitFlags(cfg any) error

InitFlags initializes the flagset with the provided config.

func (*Manager) ReadFromFile

func (mgr *Manager) ReadFromFile(fs *pflag.FlagSet) error

ReadFromFile reads the config from the file set with the `config` flag. Use `AddConfigFlag` to add the config flag to the root flagset.

func (*Manager) Unmarshal

func (mgr *Manager) Unmarshal(config interface{}) error

Unmarshal unmarshals the read config into the provided struct.

func (*Manager) Viper

func (mgr *Manager) Viper() *viper.Viper

Viper returns viper.

Jump to

Keyboard shortcuts

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