config

package
v0.4.21 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 17 Imported by: 2

Documentation

Index

Constants

View Source
const (
	EnvPrefix = "NODE"

	Environment = "environment"

	EnvironmentDevelopment = "development"
	EnvironmentProduction  = "production"

	EnvironmentPyroscopeEndpoint = EnvPrefix + "_PYROSCOPE_ENDPOINT"
)

Variables

This section is empty.

Functions

func EvmAddressHookFunc

func EvmAddressHookFunc() mapstructure.DecodeHookFuncType

Types

type Database

type Database struct {
	Driver    database.Driver `mapstructure:"driver" validate:"required" default:"cockroachdb"`
	Partition *bool           `mapstructure:"partition" validate:"required" default:"true"`
	URI       string          `mapstructure:"uri" validate:"required" default:"postgres://root@localhost:26257/defaultdb"`
}

type Discovery

type Discovery struct {
	Maintainer *Maintainer `mapstructure:"maintainer"`
	Server     *Server     `mapstructure:"server"`
}

type Endpoint added in v0.4.20

type Endpoint struct {
	URL           string            `mapstructure:"url"`
	HTTPHeaders   map[string]string `mapstructure:"http_headers"`
	HTTP2Disabled bool              `mapstructure:"http2_disabled"`
}

func (Endpoint) BuildEthereumOptions added in v0.4.20

func (e Endpoint) BuildEthereumOptions() []ethereum.Option

BuildEthereumOptions builds the custom options to be supplied to an ethereum client.

type File

type File struct {
	Environment   string              `mapstructure:"environment" validate:"required" default:"development"`
	Endpoints     map[string]Endpoint `mapstructure:"endpoints"`
	Discovery     *Discovery          `mapstructure:"discovery" validate:"required"`
	Node          *Node               `mapstructure:"component" validate:"required"`
	Database      *Database           `mapstructure:"database" validate:"required"`
	Stream        *Stream             `mapstructure:"stream" validate:"required"`
	Redis         *Redis              `mapstructure:"redis" validate:"required"`
	Observability *Telemetry          `mapstructure:"observability" validate:"required"`
}

func Setup

func Setup(configName string) (*File, error)

func (*File) LoadModulesEndpoint added in v0.4.20

func (f *File) LoadModulesEndpoint() error

LoadModulesEndpoint loads the endpoint url and headers for each module. If the endpoint id is not found in the endpoints list, it will use the endpoint id as the url.

type Maintainer

type Maintainer struct {
	EvmAddress common.Address `mapstructure:"evm_address"`
	Signature  string         `mapstructure:"signature"`
}

type Module

type Module struct {
	Network      network.Network `mapstructure:"network" validate:"required"`
	EndpointID   string          `mapstructure:"endpoint" validate:"required"`
	IPFSGateways []string        `mapstructure:"ipfs_gateways"`
	Worker       worker.Worker   `mapstructure:"worker"`
	Parameters   *Parameters     `mapstructure:"parameters"`
	Endpoint     Endpoint        `mapstructure:"-"`
}

func (*Module) ID

func (c *Module) ID() string

ID returns the unique identifier of the configuration.

type Node

type Node struct {
	RSS           []*Module `mapstructure:"rss" validate:"dive"`
	Federated     []*Module `mapstructure:"federated" validate:"dive"`
	Decentralized []*Module `mapstructure:"decentralized" validate:"dive"`
}

type OpenTelemetryConfig

type OpenTelemetryConfig struct {
	Metrics *OpenTelemetryMetricsConfig `mapstructure:"metrics" validate:"required"`
	Traces  *OpenTelemetryTracesConfig  `mapstructure:"traces" validate:"required"`
}

type OpenTelemetryMetricsConfig

type OpenTelemetryMetricsConfig struct {
	Enable   bool   `mapstructure:"enable" default:"false"`
	Endpoint string `mapstructure:"endpoint" default:"0.0.0.0:9090"`
}

type OpenTelemetryTracesConfig

type OpenTelemetryTracesConfig struct {
	Enable   bool   `mapstructure:"enable" default:"false"`
	Insecure bool   `mapstructure:"insecure" default:"false"`
	Endpoint string `mapstructure:"endpoint" validate:"required" default:"0.0.0.0:4318"`
}

type Parameters added in v0.4.13

type Parameters map[string]any

func (*Parameters) Decode added in v0.4.13

func (p *Parameters) Decode(v interface{}) error

func (*Parameters) String added in v0.4.13

func (p *Parameters) String() string

type Redis added in v0.3.11

type Redis struct {
	Endpoints    []string `mapstructure:"endpoints" default:"['localhost:6379']" validate:"required"`
	Username     string   `mapstructure:"username"`
	Password     string   `mapstructure:"password"`
	DisableCache bool     `mapstructure:"disable_cache" default:"true"`
	TLS          RedisTLS `mapstructure:"tls"`
}

type RedisTLS added in v0.3.11

type RedisTLS struct {
	Enabled            bool   `mapstructure:"enabled" default:"false"`
	CAFile             string `mapstructure:"ca_file"`
	CertFile           string `mapstructure:"cert_file"`
	KeyFile            string `mapstructure:"key_file"`
	InsecureSkipVerify bool   `mapstructure:"insecure_skip_verify" default:"false"`
}

type Server

type Server struct {
	Endpoint              string `mapstructure:"endpoint"`
	GlobalIndexerEndpoint string `mapstructure:"global_indexer_endpoint"`
}

type Stream

type Stream struct {
	Enable *bool         `mapstructure:"enable" validate:"required" default:"false"`
	Driver stream.Driver `mapstructure:"driver" validate:"required" default:"kafka"`
	Topic  string        `mapstructure:"topic" validate:"required" default:"rss3.node.activities"`
	URI    string        `mapstructure:"uri" validate:"required" default:"localhost:9092"`
}

type Telemetry

type Telemetry struct {
	OpenTelemetry *OpenTelemetryConfig `mapstructure:"opentelemetry" validate:"required"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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