config

package module
v0.0.0-...-e664631 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2019 License: Apache-2.0 Imports: 5 Imported by: 220

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterConfigurationProvider

func RegisterConfigurationProvider(driverName string, fn NewConfigProviderFunc)

Types

type Config

type Config struct {
	ConfigFile   string
	ConfigString string

	Configuration
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(opts ...Option) *Config

func (*Config) String

func (p *Config) String() string

func (*Config) WithFallback

func (p *Config) WithFallback(fallback Configuration) Configuration

type Configuration

type Configuration interface {
	GetBoolean(path string, defaultVal ...bool) bool
	GetByteSize(path string) *big.Int
	GetInt32(path string, defaultVal ...int32) int32
	GetInt64(path string, defaultVal ...int64) int64
	GetString(path string, defaultVal ...string) string
	GetFloat32(path string, defaultVal ...float32) float32
	GetFloat64(path string, defaultVal ...float64) float64
	GetTimeDuration(path string, defaultVal ...time.Duration) time.Duration
	GetTimeDurationInfiniteNotAllowed(path string, defaultVal ...time.Duration) time.Duration
	GetBooleanList(path string) []bool
	GetFloat32List(path string) []float32
	GetFloat64List(path string) []float64
	GetInt32List(path string) []int32
	GetInt64List(path string) []int64
	GetByteList(path string) []byte
	GetStringList(path string) []string
	GetConfig(path string) Configuration
	WithFallback(fallback Configuration) Configuration
	HasPath(path string) bool
	Keys() []string
	IsEmpty() bool
	IsObject(path string) bool
	IsArray(path string) bool

	String() string
}

func NewHOCONConfiguration

func NewHOCONConfiguration(conf *configuration.Config) Configuration

type ConfigurationProvider

type ConfigurationProvider interface {
	LoadConfig(filename string) Configuration
	ParseString(cfgStr string) Configuration
}

func NewConfigurationProvider

func NewConfigurationProvider(driverName string) (provider ConfigurationProvider, err error)

func NewHOCONConifProvider

func NewHOCONConifProvider() (ConfigurationProvider, error)

type HOCONConfigProvider

type HOCONConfigProvider struct {
}

func (*HOCONConfigProvider) LoadConfig

func (p *HOCONConfigProvider) LoadConfig(filename string) Configuration

func (*HOCONConfigProvider) ParseString

func (p *HOCONConfigProvider) ParseString(cfgStr string) Configuration

type HOCONConfiguration

type HOCONConfiguration struct {
	*configuration.Config
}

func (*HOCONConfiguration) GetBoolean

func (p *HOCONConfiguration) GetBoolean(path string, defaultVal ...bool) bool

func (*HOCONConfiguration) GetBooleanList

func (p *HOCONConfiguration) GetBooleanList(path string) []bool

func (*HOCONConfiguration) GetByteList

func (p *HOCONConfiguration) GetByteList(path string) []byte

func (*HOCONConfiguration) GetByteSize

func (p *HOCONConfiguration) GetByteSize(path string) *big.Int

func (*HOCONConfiguration) GetConfig

func (p *HOCONConfiguration) GetConfig(path string) Configuration

func (*HOCONConfiguration) GetFloat32

func (p *HOCONConfiguration) GetFloat32(path string, defaultVal ...float32) float32

func (*HOCONConfiguration) GetFloat32List

func (p *HOCONConfiguration) GetFloat32List(path string) []float32

func (*HOCONConfiguration) GetFloat64

func (p *HOCONConfiguration) GetFloat64(path string, defaultVal ...float64) float64

func (*HOCONConfiguration) GetFloat64List

func (p *HOCONConfiguration) GetFloat64List(path string) []float64

func (*HOCONConfiguration) GetInt32

func (p *HOCONConfiguration) GetInt32(path string, defaultVal ...int32) int32

func (*HOCONConfiguration) GetInt32List

func (p *HOCONConfiguration) GetInt32List(path string) []int32

func (*HOCONConfiguration) GetInt64

func (p *HOCONConfiguration) GetInt64(path string, defaultVal ...int64) int64

func (*HOCONConfiguration) GetInt64List

func (p *HOCONConfiguration) GetInt64List(path string) []int64

func (*HOCONConfiguration) GetString

func (p *HOCONConfiguration) GetString(path string, defaultVal ...string) string

func (*HOCONConfiguration) GetStringList

func (p *HOCONConfiguration) GetStringList(path string) []string

func (*HOCONConfiguration) GetTimeDuration

func (p *HOCONConfiguration) GetTimeDuration(path string, defaultVal ...time.Duration) time.Duration

func (*HOCONConfiguration) GetTimeDurationInfiniteNotAllowed

func (p *HOCONConfiguration) GetTimeDurationInfiniteNotAllowed(path string, defaultVal ...time.Duration) time.Duration

func (*HOCONConfiguration) HasPath

func (p *HOCONConfiguration) HasPath(path string) bool

func (*HOCONConfiguration) IsArray

func (p *HOCONConfiguration) IsArray(path string) bool

func (*HOCONConfiguration) IsEmpty

func (p *HOCONConfiguration) IsEmpty() bool

func (*HOCONConfiguration) IsObject

func (p *HOCONConfiguration) IsObject(path string) bool

func (*HOCONConfiguration) Keys

func (p *HOCONConfiguration) Keys() []string

func (*HOCONConfiguration) String

func (p *HOCONConfiguration) String() string

func (*HOCONConfiguration) WithFallback

func (p *HOCONConfiguration) WithFallback(fallback Configuration) Configuration

type NewConfigProviderFunc

type NewConfigProviderFunc func() (ConfigurationProvider, error)

type Option

type Option func(*Config)

func ConfigFile

func ConfigFile(fn string) Option

func ConfigProvider

func ConfigProvider(provider ConfigurationProvider) Option

func ConfigProviderByName

func ConfigProviderByName(driverName string) Option

func ConfigString

func ConfigString(str string) Option

func WithConfig

func WithConfig(conf Configuration) Option

Jump to

Keyboard shortcuts

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