config

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: MIT Imports: 7 Imported by: 1

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

View Source
const (
	EnvPrefix = "ORIGADMIN_SERVICE"
)

Variables

View Source
var DefaultRuntimeConfig = NewRuntimeConfig()

DefaultRuntimeConfig is a pre-initialized RuntimeConfig instance.

View Source
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

func GetTypeConfigs(cc *configv1.Customize, typo string) map[string]*configv1.Customize_Config

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 Config

type Config = kratosconfig.Config

Define types from kratos config package

func New

func New(opts ...Option) Config

New returns a new config instance

type CustomizeOption added in v0.0.4

type CustomizeOption struct {
	Customize *configv1.Customize
}

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 Decoder

type Decoder = kratosconfig.Decoder

Define types from kratos config package

type Encoder

type Encoder func(v any) ([]byte, error)

Encoder is a function that takes a value and returns a byte slice and an error.

type EndpointURLFunc

type EndpointURLFunc = func(scheme string, host string, addr string) (string, error)

type KeyValue

type KeyValue = kratosconfig.KeyValue

Define types from kratos config package

type Merge

type Merge = kratosconfig.Merge

Define types from kratos config package

type Observer

type Observer = kratosconfig.Observer

Define types from kratos config package

type Option

type Option = kratosconfig.Option

Define types from kratos config package

func WithDecoder

func WithDecoder(d Decoder) Option

WithDecoder sets the decoder

func WithMergeFunc

func WithMergeFunc(m Merge) Option

WithMergeFunc sets the merge function

func WithResolveActualTypes

func WithResolveActualTypes(enableConvertToType bool) Option

WithResolveActualTypes enables resolving actual types

func WithResolver

func WithResolver(r Resolver) Option

WithResolver sets the resolver

func WithSource

func WithSource(s ...Source) Option

WithSource sets the source

type Reader

type Reader = kratosconfig.Reader

Define types from kratos config package

type Resolver

type Resolver = kratosconfig.Resolver

Define types from kratos config package

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 Source

type Source = kratosconfig.Source

Define types from kratos config package

type SourceOption

type SourceOption struct {
	Options []Option
	Decoder Decoder
	Encoder Encoder
}

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.

type Value

type Value = kratosconfig.Value

Define types from kratos config package

type Watcher

type Watcher = kratosconfig.Watcher

Define types from kratos config package

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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