config

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Replacer = strings.NewReplacer(".", "_", "-", "_")

Functions

This section is empty.

Types

type AutocertConfig

type AutocertConfig struct {
	Email string   `mapstructure:"email"`
	Hosts []string `mapstructure:"hosts"`
}

type CORSConfig

type CORSConfig struct {
	AllowOrigin  string `mapstructure:"allow-origin"`
	AllowMethods string `mapstructure:"allow-methods"`
	AllowHeaders string `mapstructure:"allow-headers"`
}

type Config

type Config struct {
	Server  ServerConfig  `mapstructure:"server"`
	TLS     TLSConfig     `mapstructure:"tls"`
	Seed    SeedConfig    `mapstructure:"seed"`
	Health  HealthConfig  `mapstructure:"health"`
	CORS    CORSConfig    `mapstructure:"cors"`
	Metrics MetricsConfig `mapstructure:"metrics"`
}

func Read

func Read(v *viper.Viper) (Config, error)

Read returns the configuration from viper.Viper. Returns error if unable to unmarshal.

type HealthConfig

type HealthConfig struct {
	HealthyThreshold    time.Duration `mapstructure:"healthy-threshold"`
	ProxyRequestTimeout time.Duration `mapstructure:"proxy-request-timeout"`
}

type MetricsConfig

type MetricsConfig struct {
	Enabled     bool   `mapstructure:"enabled"`
	Listen      string `mapstructure:"listen"`
	Path        string `mapstructure:"path"`
	ServiceName string `mapstructure:"service-name"`
}

type SeedConfig

type SeedConfig struct {
	URL             string        `mapstructure:"url"`
	RefreshInterval time.Duration `mapstructure:"refresh-interval"`
	ChainID         string        `mapstructure:"chain-id"`
	EnableRemote    bool          `mapstructure:"enable-remote"`
	AdditionalNodes struct {
		RPC  []string `mapstructure:"rpc"`
		REST []string `mapstructure:"rest"`
		GRPC []string `mapstructure:"grpc"`
	} `mapstructure:"additional-nodes"`
}

type ServerConfig

type ServerConfig struct {
	Listen     string        `mapstructure:"listen"`
	ListenGRPC string        `mapstructure:"listen-grpc"`
	GRPCTLS    bool          `mapstructure:"grpc-tls"`
	Timeouts   TimeoutConfig `mapstructure:"timeouts"`
}

type TLSConfig

type TLSConfig struct {
	Autocert AutocertConfig `mapstructure:"autocert"`
	Cert     string         `mapstructure:"cert"`
	Key      string         `mapstructure:"key"`
}

type TimeoutConfig

type TimeoutConfig struct {
	Read  time.Duration `mapstructure:"read"`
	Write time.Duration `mapstructure:"write"`
	Idle  time.Duration `mapstructure:"idle"`
}

Jump to

Keyboard shortcuts

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