Documentation ¶
Index ¶
- Variables
- func GetConfigurationKey(r configapi.RequestedConfigurationKey) string
- func GetConfigurationKeyFromCfg(c configapi.Configuration) string
- func GetConfigurationSync()
- func Must[T any](val T, err error) T
- func MustDefault[T any](dv T) defaultVal[T]
- type Client
- type ClientAdv
- type ClientOptions
- type ConfigContainer
- type EnvClient
- func (c *EnvClient) CaseInsensitive() *EnvClient
- func (c *EnvClient) GetBool(key string) (bool, error)
- func (c *EnvClient) GetFloat(key string) (float64, error)
- func (c *EnvClient) GetInt(key string) (int, error)
- func (c *EnvClient) GetInt64(key string) (int64, error)
- func (c *EnvClient) GetString(key string) (string, error)
- func (e *EnvClient) ParserWarning() error
- type RequiredConfig
- type Unmarshaler
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoSuchEnvironmentVariable = errors.New("no such environment variable") ErrHasDuplicatedKeysWithDifferentCaseFormat = errors.New("duplicated keys with different case format") )
var (
ErrWaitStartupLoadedTimeout = errors.New("wait startup loaded timeout")
)
Functions ¶
func GetConfigurationKey ¶
func GetConfigurationKey(r configapi.RequestedConfigurationKey) string
func GetConfigurationKeyFromCfg ¶
func GetConfigurationKeyFromCfg(c configapi.Configuration) string
func GetConfigurationSync ¶
func GetConfigurationSync()
func MustDefault ¶ added in v0.11.0
func MustDefault[T any](dv T) defaultVal[T]
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(serverList []string, opt ClientOptions) *Client
func (*Client) AddConfigurationRequirement ¶
func (c *Client) AddConfigurationRequirement(req RequiredConfig)
func (*Client) StartClient ¶
func (*Client) StopClient ¶
type ClientAdv ¶
type ClientAdv struct {
// contains filtered or unexported fields
}
func NewClientAdv ¶
func (*ClientAdv) Register ¶
func (c *ClientAdv) Register(group, key string, unmarshaler Unmarshaler, container any) (*atomic.Value, error)
Register will register auto updated configure container with the same type as the container provided Note that any further update has to be accessed via responded container rather than the container provided in the parameter
type ClientOptions ¶
type ClientOptions struct { SelectorEnvironment string SelectorDatacenter string SelectorNamespace string SelectorApp string SelectorCluster string SelectorHostName string SelectorBeta string OverrideSelectors *configapi.Selectors // used for overriding detail selector config OverrideOptionalSelectors *configapi.Selectors // used for overriding detail selector config Auth string LocalFallbackDataPath string AllowedLocalFallbackDataTTL int64 // In seconds. Compare to last retrieved time rather than configuration timestamp. AcquireFullConfigurationsInterval int64 // Effective > 0 (in seconds). Used for 1. refresh data, 2. keep fallback data fresh }
func (*ClientOptions) ToOptSelectors ¶
func (c *ClientOptions) ToOptSelectors() configapi.Selectors
func (*ClientOptions) ToSelectors ¶
func (c *ClientOptions) ToSelectors() configapi.Selectors
type ConfigContainer ¶ added in v0.10.10
type ConfigContainer[T any] struct { // OnChange is called when any update on the configuration OnChange func(cfg configapi.Configuration, container T) // contains filtered or unexported fields }
ConfigContainer contains the configuration retrieved from the server with auto refresh support
func (*ConfigContainer[T]) Get ¶ added in v0.10.10
func (cc *ConfigContainer[T]) Get() T
func (*ConfigContainer[T]) Register ¶ added in v0.10.10
func (cc *ConfigContainer[T]) Register(c *ClientAdv, group, key string, unmarshaler Unmarshaler) error
Register will register auto updated configure container with the same type as the container provided Note that any further update has to be accessed via responded container rather than the container provided in the parameter
func (*ConfigContainer[T]) RegisterJsonContainer ¶ added in v0.10.10
func (cc *ConfigContainer[T]) RegisterJsonContainer(c *ClientAdv, group, key string) error
RegisterJsonContainer will register auto updated configure container with json configure support Note: the behavior is the same as Register method
type EnvClient ¶ added in v0.11.0
type EnvClient struct {
// contains filtered or unexported fields
}
func NewEnvClient ¶ added in v0.11.0
func NewEnvClient() *EnvClient
func (*EnvClient) CaseInsensitive ¶ added in v0.11.0
func (*EnvClient) ParserWarning ¶ added in v0.11.0
type RequiredConfig ¶
type RequiredConfig struct { Required configapi.RequestedConfigurationKey Callback func(cfg configapi.Configuration) }