config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 18 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 CalculateComponentCount added in v1.1.2

func CalculateComponentCount(config *File) int

CalculateComponentCount returns the number of components deployed

func CalculateWorkerCount added in v1.1.2

func CalculateWorkerCount(config *File) int

CalculateWorkerCount returns the number of workers deployed

func EvmAddressHookFunc

func EvmAddressHookFunc() mapstructure.DecodeHookFuncType

func HasOneWorker added in v1.1.2

func HasOneWorker(config *File) error

HasOneWorker Check if there is at least one worker deployed

func IsRSSComponentOnly added in v1.1.2

func IsRSSComponentOnly(config *File) bool

IsRSSComponentOnly Check if the configuration contains an RSS component only

Types

type Component added in v0.4.22

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

type Database

type Database struct {
	CoveragePeriod int    `mapstructure:"coverage_period" validate:"min=3,max=12" default:"3"`
	URI            string `mapstructure:"uri" validate:"required" default:"postgres://postgres@localhost:5432/postgres"`
}

type Discovery

type Discovery struct {
	Operator *Operator `mapstructure:"operator"`
	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"`
	Component     *Component          `mapstructure:"component" validate:"required"`
	Database      *Database           `mapstructure:"database" validate:"required"`
	Stream        *Stream             `mapstructure:"stream"`
	Redis         *Redis              `mapstructure:"redis"`
	Observability *Telemetry          `mapstructure:"observability"`
}

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 Module

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

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 Operator added in v0.5.1

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

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 {
	Endpoint string   `mapstructure:"endpoint" default:"localhost:6379" validate:"required"`
	Username string   `mapstructure:"username"`
	Password string   `mapstructure:"password"`
	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"`
	AccessToken           string `mapstructure:"access_token"`
}

type Stream

type Stream struct {
	Enable *bool  `mapstructure:"enable" validate:"required" default:"false"`
	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