config

package module
v0.0.0-...-b9d6a86 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadGlobalConfig

func LoadGlobalConfig(configPath string) error

func SetGlobalConfig

func SetGlobalConfig(cfg *Config)

Types

type BackendConfig

type BackendConfig struct {
	ServiceName string `yaml:"name"`      // service name
	Target      string `yaml:"target"`    // dsn or other
	Network     string `yaml:"network"`   // tcp/udp
	Protocol    string `yaml:"protocol"`  // tars/http
	Namespace   string `yaml:"namespace"` // namespace
	Timeout     int    `yaml:"timeout"`   // Timeout in milliseconds.
}

func GetClientConfig

func GetClientConfig(serviceName string) *BackendConfig

func (*BackendConfig) String

func (c *BackendConfig) String() string

type ClientConfig

type ClientConfig struct {
	Network   string           `yaml:"network"`   // Network for all backends. Default is tcp.
	Protocol  string           `yaml:"protocol"`  // Protocol for all backends. Default is trpc.
	Namespace string           `yaml:"namespace"` // Namespace for all backends.
	Timeout   int              `yaml:"timeout"`   // Timeout in milliseconds.
	Service   []*BackendConfig `yaml:"service"`   // Configuration for each individual backend.
}

type Config

type Config struct {
	Global struct {
		Namespace string `yaml:"namespace"`
		EnvName   string `yaml:"env_name"`
	}
	Client ClientConfig `yaml:"client"`
}

func GlobalConfig

func GlobalConfig() *Config

func LoadConfig

func LoadConfig(configPath string) (*Config, error)

Jump to

Keyboard shortcuts

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