config

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrTypeCastNotSupported type cast is not supported
	ErrTypeCastNotSupported = errors.New("type cast not supported")

	//ErrNotFound value is not found
	ErrNotFound = errors.New("value not found")
)

Functions

func InitGlobalConfig

func InitGlobalConfig(opts ...Option) error

InitGlobalConfig init global config

Types

type AuthnType added in v1.15.0

type AuthnType string

AuthnType is a authentication type variants

const (
	// AuthnTypeNONE - nonsecured - is by default
	AuthnTypeNONE AuthnType = "none"
	// AuthnTypeTLS - use TLS
	AuthnTypeTLS AuthnType = "tls"
)

func (AuthnType) Eq added in v1.15.0

func (o AuthnType) Eq(other AuthnType) bool

Eq config.OneOf

func (AuthnType) Variants added in v1.15.0

func (AuthnType) Variants() []AuthnType

Variants impl config.OneOf

type AuthnTypeSelector added in v1.15.0

type AuthnTypeSelector = ValueT[AuthnType]

AuthnTypeSelector is a authentication type selector

type Defaulter

type Defaulter[T any] struct {
	ValueOpt[T]
	Def func() (T, error)
}

Defaulter ...

type IP

type IP struct {
	net.IP
}

IP -

func (IP) MarshalJSON

func (ip IP) MarshalJSON() ([]byte, error)

MarshalJSON -

func (IP) String

func (ip IP) String() string

String -

func (*IP) UnmarshalJSON

func (ip *IP) UnmarshalJSON(b []byte) error

UnmarshalJSON -

type KnownValueTypes

type KnownValueTypes interface {
	time.Time |
		NetCIDR |
		~[]NetCIDR |
		IP |
		~[]IP |
		~int | ~uint |
		~int64 | ~uint64 |
		~int32 | ~uint32 |
		~int16 | ~uint16 |
		~int8 | ~uint8 |
		~float32 | ~float64 |
		~string | ~bool |
		~[]string
}

KnownValueTypes ...

type NetCIDR

type NetCIDR struct {
	*net.IPNet
}

func (NetCIDR) MarshalJSON

func (c NetCIDR) MarshalJSON() ([]byte, error)

MarshalJSON -

func (NetCIDR) String

func (c NetCIDR) String() string

String -

func (*NetCIDR) UnmarshalJSON

func (c *NetCIDR) UnmarshalJSON(b []byte) error

UnmarshalJSON -

type OneOf

type OneOf[T any] interface {
	Variants() []T
	Eq(T) bool
}

OneOf -

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option config init option

type Sink

type Sink[T any] struct {
	ValueOpt[T]
	In func(T) error
}

Sink ...

type TLScaFiles added in v1.15.0

type TLScaFiles = ValueT[[]string]

TLScaFiles CA PEM encoded list ["file1.pem", "cert.pem",...]

type TLScertFile added in v1.15.0

type TLScertFile = ValueT[string]

TLScertFile cert PEM encoded file

type TLSclientVerification added in v1.15.0

type TLSclientVerification string

TLSclientVerification verification client on TLS handshake

const (
	// TLSclientSkipVerify - client is nonsecured
	TLSclientSkipVerify TLSclientVerification = "skip"

	// TLSclentCertsRequied - server requires the client must have any cert(s)
	TLSclentCertsRequied TLSclientVerification = "certs-required"

	// TLSclientMustVerify
	TLSclientMustVerify TLSclientVerification = "verify"
)

func (TLSclientVerification) Eq added in v1.15.0

Eq config.OneOf

func (TLSclientVerification) Variants added in v1.15.0

Variants impl config.OneOf

type TLSclientVerifyStrategy added in v1.15.0

type TLSclientVerifyStrategy = ValueT[TLSclientVerification]

TLSclientVerifyStrategy - client conn verification strategy

type TLSprivKeyFile added in v1.15.0

type TLSprivKeyFile = ValueT[string]

TLSprivKeyFile private PEM encoded file

type TLSverifysServerName added in v1.15.0

type TLSverifysServerName = ValueT[string]

TLSverifysServerName server name to verify on TLS handshake

type Value

type Value[T any] interface {
	String() string
	MustValue(ctx context.Context, opts ...ValueOpt[T]) T
	Value(ctx context.Context, opts ...ValueOpt[T]) (T, error)
}

Value config value interface

type ValueOpt

type ValueOpt[T any] interface {
	// contains filtered or unexported methods
}

ValueOpt ...

type ValueT

type ValueT[T any] string

ValueT typed value accessor

func String2ValueT

func String2ValueT[T any](s string) ValueT[T]

String2ValueT ...

func (ValueT[T]) MustValue

func (v ValueT[T]) MustValue(ctx context.Context, opts ...ValueOpt[T]) T

MustValue gets value or panics

func (ValueT[T]) OptDefaulter

func (v ValueT[T]) OptDefaulter(f func() (T, error)) ValueOpt[T]

OptDefaulter ...

func (ValueT[T]) OptSink

func (v ValueT[T]) OptSink(f func(T) error) ValueOpt[T]

OptSink ...

func (ValueT[T]) String

func (v ValueT[T]) String() string

String stringer impl

func (ValueT[T]) Value

func (v ValueT[T]) Value(_ context.Context, opts ...ValueOpt[T]) (ret T, err error)

Value ...

type WithAcceptEnvironment

type WithAcceptEnvironment struct {
	Option
	EnvPrefix string
}

WithAcceptEnvironment option

type WithDefValue

type WithDefValue struct {
	Option
	Key interface{}
	Val interface{}
}

WithDefValue option

type WithSource

type WithSource struct {
	Option
	Source io.Reader
	Type   string
}

WithSource option

type WithSourceFile

type WithSourceFile struct {
	Option
	FileName string
}

WithSourceFile option

Jump to

Keyboard shortcuts

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