config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValid

func IsValid(addr string) bool

func MergeValue

func MergeValue(str1, str2, def string) string

func NewEnvInstance

func NewEnvInstance()

NewEnvInstance creates Environment instance

func TranslateIds

func TranslateIds(registryIds []string) []string

TranslateIds string "nacos,zk" => ["nacos","zk"]

func Verify

func Verify(s interface{}) error

Types

type Environment

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

Environment There is dubbo.properties file and application level config center configuration which is higher than normal config center in java. So in java the configuration sequence will be config center > application level config center > dubbo.properties > spring bean configuration. But in go, neither the dubbo.properties file or application level config center configuration will not support for the time being. We just have config center configuration which can override configuration in consumer.yaml & provider.yaml. But for add these features in future ,I finish the environment struct following Environment class in java.

func GetEnvInstance

func GetEnvInstance() *Environment

GetEnvInstance gets env instance by singleton

func (*Environment) Configuration

func (env *Environment) Configuration() *list.List

Configuration puts externalConfigMap and appExternalConfigMap into list List represents a doubly linked list.

func (*Environment) GetDynamicConfiguration

func (env *Environment) GetDynamicConfiguration() config_center.DynamicConfiguration

GetDynamicConfiguration gets dynamicConfiguration

func (*Environment) SetDynamicConfiguration

func (env *Environment) SetDynamicConfiguration(dc config_center.DynamicConfiguration)

SetDynamicConfiguration sets value for dynamicConfiguration

func (*Environment) UpdateAppExternalConfigMap

func (env *Environment) UpdateAppExternalConfigMap(externalMap map[string]string)

UpdateAppExternalConfigMap updates env appExternalConfigMap field

func (*Environment) UpdateExternalConfigMap

func (env *Environment) UpdateExternalConfigMap(externalMap map[string]string)

UpdateExternalConfigMap updates env externalConfigMap field

type InmemoryConfiguration

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

InmemoryConfiguration stores config in memory

func (*InmemoryConfiguration) GetProperty

func (conf *InmemoryConfiguration) GetProperty(key string) (bool, string)

GetProperty gets value from InmemoryConfiguration instance by @key

func (*InmemoryConfiguration) GetSubProperty

func (conf *InmemoryConfiguration) GetSubProperty(subKey string) map[string]struct{}

GetSubProperty gets sub property from InmemoryConfiguration instance by @subkey

Jump to

Keyboard shortcuts

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