config

package
v0.0.0-...-1132805 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2022 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RedactedPassword = "*********"
)

Variables

This section is empty.

Functions

func AddExpander

func AddExpander(name string, priority int64, e Expander)

func EnvKey

func EnvKey(sectionName string, keyName string) string

func ExpandVar

func ExpandVar(s string) (string, error)

func GetExpanderRegex

func GetExpanderRegex() *regexp.Regexp

Slightly hacky function to avoid code duplication. If this is eventually called in multiple places, consider refactoring or potentially adding more general helper functions to this package

func PathExists

func PathExists(path string) bool

func RedactedURL

func RedactedURL(value string) (string, error)

func RedactedValue

func RedactedValue(key, value string) string

Types

type Config

type Config struct {
	Raw    *ini.File
	Logger log.Logger
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(homePath string) *Config

func (*Config) GetSection

func (config *Config) GetSection(name string) (*Section, error)

func (*Config) Load

func (config *Config) Load(commandLineProps map[string]string, specifiedConfigFile string) error

func (*Config) LogConfigSources

func (config *Config) LogConfigSources()

func (*Config) NewSection

func (config *Config) NewSection(name string) (*Section, error)

func (*Config) Section

func (config *Config) Section(name string) *Section

func (*Config) Sections

func (config *Config) Sections() []*ini.Section

type Expander

type Expander interface {
	SetupExpander(file *ini.File) error
	Expand(string) (string, error)
}

type Section

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

func (*Section) Key

func (section *Section) Key(name string) *ini.Key

func (*Section) Keys

func (section *Section) Keys() []*ini.Key

func (*Section) Name

func (section *Section) Name() string

func (*Section) NewKey

func (section *Section) NewKey(name string, val string) (*ini.Key, error)

func (*Section) ValueAsString

func (section *Section) ValueAsString(keyName string, defaultValue string) string

Jump to

Keyboard shortcuts

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