Documentation ¶
Overview ¶
Package config implements the functions, types, and interfaces for the module.
Package config implements the functions, types, and interfaces for the module.
Package config implements the functions, types, and interfaces for the module.
Package config implements the functions, types, and interfaces for the module.
Package config implements the functions, types, and interfaces for the module.
Package config implements the functions, types, and interfaces for the module.
Package config implements the functions, types, and interfaces for the module.
Index ¶
- Constants
- Variables
- func GetNameConfig(cc *configv1.Customize, name string) *configv1.Customize_Config
- func GetTypeConfigs(cc *configv1.Customize, typo string) map[string]*configv1.Customize_Config
- type BootstrapOption
- type BootstrapOptionSetting
- type Config
- type CustomizeOption
- type CustomizeOptionSetting
- type Decoder
- type Encoder
- type EndpointURLFunc
- type KeyValue
- type Merge
- type Observer
- type Option
- type Reader
- type Resolver
- type RuntimeConfig
- type RuntimeConfigSetting
- type SelectorGRPCFunc
- type SelectorHTTPFunc
- type SelectorOption
- type SelectorOptionSetting
- type ServiceOption
- type ServiceOptionSetting
- type Source
- type SourceOption
- type SourceOptionSetting
- type Value
- type Watcher
Constants ¶
const (
EnvPrefix = "ORIGADMIN_SERVICE"
)
Variables ¶
var DefaultRuntimeConfig = NewRuntimeConfig()
DefaultRuntimeConfig is a pre-initialized RuntimeConfig instance.
var ( // ErrNotFound defined error from kratos config package ErrNotFound = kratosconfig.ErrNotFound )
Functions ¶
func GetNameConfig ¶ added in v0.0.4
func GetNameConfig(cc *configv1.Customize, name string) *configv1.Customize_Config
GetNameConfig returns the config with the given name.
func GetTypeConfigs ¶ added in v0.0.4
GetTypeConfigs returns all configs with the given type.
Types ¶
type BootstrapOption ¶ added in v0.0.6
type BootstrapOption struct {
EnvPrefix string
}
type BootstrapOptionSetting ¶ added in v0.0.6
type BootstrapOptionSetting = func(s *BootstrapOption)
BootstrapOptionSetting is a function that takes a pointer to a BootstrapOption struct and modifies it.
func WithBootstrapEnvPrefix ¶ added in v0.0.6
func WithBootstrapEnvPrefix(prefix string) BootstrapOptionSetting
type CustomizeOption ¶ added in v0.0.4
CustomizeOption is a struct that holds a value.
type CustomizeOptionSetting ¶ added in v0.0.4
type CustomizeOptionSetting = func(option *CustomizeOption)
CustomizeOptionSetting is a function that sets a value on a Setting.
func WithCustomizeConfig ¶ added in v0.0.4
func WithCustomizeConfig(customize *configv1.Customize) CustomizeOptionSetting
WithCustomizeConfig sets the customize config.
type EndpointURLFunc ¶
type Option ¶
type Option = kratosconfig.Option
Define types from kratos config package
func WithResolveActualTypes ¶
WithResolveActualTypes enables resolving actual types
type RuntimeConfig ¶ added in v0.0.4
type RuntimeConfig struct {
// contains filtered or unexported fields
}
RuntimeConfig is a struct that holds the configuration for the runtime.
func NewRuntimeConfig ¶ added in v0.0.4
func NewRuntimeConfig(ss ...RuntimeConfigSetting) *RuntimeConfig
NewRuntimeConfig is a function that creates a new RuntimeConfig. It takes a variadic list of RuntimeConfigSettings and applies them to a new RuntimeConfig.
func (RuntimeConfig) Bootstrap ¶ added in v0.0.6
func (r RuntimeConfig) Bootstrap() *BootstrapOption
Bootstrap returns the BootstrapOption associated with the RuntimeConfig.
func (RuntimeConfig) Customize ¶ added in v0.0.4
func (r RuntimeConfig) Customize() *CustomizeOption
Customize returns the CustomizeOption associated with the RuntimeConfig.
func (RuntimeConfig) Selector ¶ added in v0.0.4
func (r RuntimeConfig) Selector() *SelectorOption
Selector returns the SelectorOption associated with the RuntimeConfig.
func (RuntimeConfig) Service ¶ added in v0.0.4
func (r RuntimeConfig) Service() *ServiceOption
Service returns the ServiceOption associated with the RuntimeConfig.
func (RuntimeConfig) Source ¶ added in v0.0.4
func (r RuntimeConfig) Source() *SourceOption
Source returns the SourceOption associated with the RuntimeConfig.
type RuntimeConfigSetting ¶ added in v0.0.4
type RuntimeConfigSetting = func(config *RuntimeConfig)
RuntimeConfigSetting is a type alias for a function that takes a pointer to a RuntimeConfig and modifies it.
func WithCustomizeOption ¶ added in v0.0.4
func WithCustomizeOption(ss ...CustomizeOptionSetting) RuntimeConfigSetting
func WithSelectorOption ¶ added in v0.0.4
func WithSelectorOption(ss ...SelectorOptionSetting) RuntimeConfigSetting
WithSelectorOption is a function that returns a RuntimeConfigSetting. This function sets the Selector field of the RuntimeConfig.
func WithServiceOption ¶ added in v0.0.4
func WithServiceOption(ss ...ServiceOptionSetting) RuntimeConfigSetting
WithServiceOption is a function that returns a RuntimeConfigSetting. This function sets the Service field of the RuntimeConfig.
func WithSourceOption ¶ added in v0.0.4
func WithSourceOption(ss ...SourceOptionSetting) RuntimeConfigSetting
WithSourceOption is a function that returns a RuntimeConfigSetting. This function sets the Source field of the RuntimeConfig.
type SelectorGRPCFunc ¶ added in v0.0.4
type SelectorGRPCFunc = func(cfg *configv1.Service_Selector) (transgrpc.ClientOption, error)
SelectorGRPCFunc is a function type that returns a gRPC client option. It takes a service selector configuration as input and returns a client option and an error.
type SelectorHTTPFunc ¶ added in v0.0.4
type SelectorHTTPFunc = func(cfg *configv1.Service_Selector) (transhttp.ClientOption, error)
SelectorHTTPFunc is a function type that returns an HTTP client option. It takes a service selector configuration as input and returns a client option and an error.
type SelectorOption ¶ added in v0.0.4
type SelectorOption struct { // GRPC is a function that returns a gRPC client option. GRPC SelectorGRPCFunc // HTTP is a function that returns an HTTP client option. HTTP SelectorHTTPFunc }
SelectorOption represents a configuration option for a selector.
type SelectorOptionSetting ¶ added in v0.0.4
type SelectorOptionSetting = func(option *SelectorOption)
SelectorOptionSetting is a function type that sets a selector option.
type ServiceOption ¶
type ServiceOption struct { // Discovery is an interface for discovering service instances. Discovery registry.Discovery // Middlewares is a list of middleware functions to be applied to the service. Middlewares []middleware.Middleware // EndpointURL is a function that generates a URL for a service endpoint. EndpointURL func(scheme string, host string, addr string) (string, error) }
ServiceOption represents a set of configuration options for a service.
type ServiceOptionSetting ¶ added in v0.0.4
type ServiceOptionSetting = func(option *ServiceOption)
ServiceOptionSetting is a function that modifies a ServiceOption.
func WithServiceDiscovery ¶ added in v0.0.4
func WithServiceDiscovery(discovery registry.Discovery) ServiceOptionSetting
WithServiceDiscovery returns a ServiceSetting that sets the Discovery field of a ServiceOption.
func WithServiceEndpointURL ¶ added in v0.0.4
func WithServiceEndpointURL(endpoint EndpointURLFunc) ServiceOptionSetting
WithServiceEndpointURL returns a ServiceSetting that sets the EndpointURL field of a ServiceOption.
func WithServiceMiddlewares ¶ added in v0.0.4
func WithServiceMiddlewares(middlewares ...middleware.Middleware) ServiceOptionSetting
WithServiceMiddlewares returns a ServiceSetting that sets the Middlewares field of a ServiceOption.
type SourceOption ¶
type SourceOptionSetting ¶ added in v0.0.4
type SourceOptionSetting = func(s *SourceOption)
SourceOptionSetting is a function that takes a pointer to a SourceOption struct and modifies it.
func WithOptions ¶
func WithOptions(options ...Option) SourceOptionSetting
WithOptions sets the options field of the SourceOption struct.