config

package
v0.0.0-...-930562d Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseAddress

func ParseAddress(raw string) (hostname, port string)

func to parse address

Types

type Chain

type Chain = struct {
	ChainID   int    `yaml:"id" koanf:"id"`
	ChainCode string `yaml:"code" koanf:"code"`
	// ChainGroup
	Algorithm string          `yaml:"algorithm,omitempty" koanf:"algorithm,omitempty"`
	Endpoints []*EndpointInfo `yaml:"endpoints,omitempty" koanf:"endpoints,omitempty"`

	Services *ChainServices `yaml:"services,omitempty" koanf:"services,omitempty"`
}

type ChainGroup

type ChainGroup = struct {
	Algorithm string          `yaml:"algorithm,omitempty" koanf:"algorithm,omitempty"`
	Endpoints []*EndpointInfo `yaml:"endpoints,omitempty" koanf:"endpoints,omitempty"`
}

type ChainServices

type ChainServices = struct {
	Activenode ChainGroup `yaml:"activenode" koanf:"activenode"`
	Fullnode   ChainGroup `yaml:"fullnode" koanf:"fullnode"`
}

type Config

type Config struct {
	App        app
	DB         db
	Logger     logger
	Middleware middleware
	Chains     []map[string]any `yaml:"loadbalances" koanf:"loadbalances"`
	APIKey     apiKey           `yaml:"apiKey"`
}

func NewConfig

func NewConfig() *Config

initialize config

func ParseConfig

func ParseConfig(file []byte) (*Config, error)

func to parse config

func ReadAndParseConfig

func ReadAndParseConfig(filename string, debug ...bool) (*Config, error)

type EndpointInfo

type EndpointInfo struct {
	Url        string             `yaml:"url" koanf:"url"`
	Headers    *map[string]string `yaml:"headers" koanf:"headers"`
	TslVersion *string            `yaml:"tsl-version" koanf:"tsl-version"`
	Weight     *int               `yaml:"weight" koanf:"weight"`
}

Jump to

Keyboard shortcuts

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