config

package
v0.0.2-rc4 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 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"`
}

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 SeedConfig

type SeedConfig struct {
	URL             string        `mapstructure:"url"`
	RefreshInterval time.Duration `mapstructure:"refresh-interval"`
	ChainID         string        `mapstructure:"chain-id"`
	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"`
	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