v2

package
v1.10.0-beta4 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EnvConfig = Env("CL_CONFIG")
	EnvDev    = Env("CL_DEV")

	EnvDatabaseAllowSimplePasswords = Env("CL_DATABASE_ALLOW_SIMPLE_PASSWORDS")
	EnvDatabaseURL                  = EnvSecret("CL_DATABASE_URL")
	EnvDatabaseBackupURL            = EnvSecret("CL_DATABASE_BACKUP_URL")
	EnvExplorerAccessKey            = EnvSecret("CL_EXPLORER_ACCESS_KEY")
	EnvExplorerSecret               = EnvSecret("CL_EXPLORER_SECRET")
	EnvPasswordKeystore             = EnvSecret("CL_PASSWORD_KEYSTORE")
	EnvPasswordVRF                  = EnvSecret("CL_PASSWORD_VRF")
	EnvPyroscopeAuthToken           = EnvSecret("CL_PYROSCOPE_AUTH_TOKEN")
)
View Source
var ErrUnsupported = errors.New("unsupported with config v2")

Functions

func DecodeTOML added in v1.10.0

func DecodeTOML(r io.Reader, v any) error

DecodeTOML decodes toml from r in to v. Requires strict field matches and returns full toml.StrictMissingError details.

func Validate added in v1.8.0

func Validate(cfg interface{}) (err error)

Validate returns any errors from calling Validated.ValidateConfig on cfg and any nested types that implement Validated.

Types

type AutoPprof

type AutoPprof struct {
	Enabled              *bool
	ProfileRoot          *string
	PollInterval         *models.Duration
	GatherDuration       *models.Duration
	GatherTraceDuration  *models.Duration
	MaxProfileSize       *utils.FileSize
	CPUProfileRate       *int64 // runtime.SetCPUProfileRate
	MemProfileRate       *int64 // runtime.MemProfileRate
	BlockProfileRate     *int64 // runtime.SetBlockProfileRate
	MutexProfileFraction *int64 // runtime.SetMutexProfileFraction
	MemThreshold         *utils.FileSize
	GoroutineThreshold   *int64
}

type Core

type Core struct {
	// General/misc
	AppID               uuid.UUID `toml:"-"` // random or test
	DevMode             bool      `toml:"-"` // from environment
	ExplorerURL         *models.URL
	InsecureFastScrypt  *bool
	RootDir             *string
	ShutdownGracePeriod *models.Duration

	Feature          Feature                 `toml:",omitempty"`
	Database         Database                `toml:",omitempty"`
	TelemetryIngress TelemetryIngress        `toml:",omitempty"`
	AuditLogger      audit.AuditLoggerConfig `toml:",omitempty"`
	Log              Log                     `toml:",omitempty"`
	WebServer        WebServer               `toml:",omitempty"`
	JobPipeline      JobPipeline             `toml:",omitempty"`
	FluxMonitor      FluxMonitor             `toml:",omitempty"`
	OCR2             OCR2                    `toml:",omitempty"`
	OCR              OCR                     `toml:",omitempty"`
	P2P              P2P                     `toml:",omitempty"`
	Keeper           Keeper                  `toml:",omitempty"`
	AutoPprof        AutoPprof               `toml:",omitempty"`
	Pyroscope        Pyroscope               `toml:",omitempty"`
	Sentry           Sentry                  `toml:",omitempty"`
}

Core holds the core configuration. See chainlink.Config for more information.

func CoreDefaults added in v1.10.0

func CoreDefaults() (c Core)

func (*Core) SetFrom added in v1.10.0

func (c *Core) SetFrom(f *Core)

SetFrom updates c with any non-nil values from f. (currently TOML field only!)

type Database

type Database struct {
	DefaultIdleInTxSessionTimeout *models.Duration
	DefaultLockTimeout            *models.Duration
	DefaultQueryTimeout           *models.Duration
	Dialect                       dialects.DialectName `toml:"-"`
	LogQueries                    *bool
	MaxIdleConns                  *int64
	MaxOpenConns                  *int64
	MigrateOnStartup              *bool

	Backup   DatabaseBackup   `toml:",omitempty"`
	Listener DatabaseListener `toml:",omitempty"`
	Lock     DatabaseLock     `toml:",omitempty"`
}

func (*Database) LockingMode added in v1.10.0

func (d *Database) LockingMode() string

type DatabaseBackup

type DatabaseBackup struct {
	Dir              *string
	Frequency        *models.Duration
	Mode             *config.DatabaseBackupMode
	OnVersionUpgrade *bool
}

DatabaseBackup

Note: url is stored in Secrets.DatabaseBackupURL

type DatabaseListener

type DatabaseListener struct {
	MaxReconnectDuration *models.Duration
	MinReconnectInterval *models.Duration
	FallbackPollInterval *models.Duration
}

type DatabaseLock

type DatabaseLock struct {
	Mode                 string `toml:"-"`
	LeaseDuration        *models.Duration
	LeaseRefreshInterval *models.Duration
}

func (*DatabaseLock) ValidateConfig added in v1.9.0

func (l *DatabaseLock) ValidateConfig() (err error)

type DatabaseSecrets added in v1.10.0

type DatabaseSecrets struct {
	URL                  *models.SecretURL
	BackupURL            *models.SecretURL
	AllowSimplePasswords bool
}

func (*DatabaseSecrets) ValidateConfig added in v1.10.0

func (d *DatabaseSecrets) ValidateConfig() (err error)

type Env added in v1.10.0

type Env string

func (Env) Get added in v1.10.0

func (e Env) Get() string

func (Env) IsTrue added in v1.10.0

func (e Env) IsTrue() bool

type EnvSecret added in v1.10.0

type EnvSecret string

func (EnvSecret) Get added in v1.10.0

func (e EnvSecret) Get() models.Secret

type ErrEmpty added in v1.8.0

type ErrEmpty struct {
	Name string
	Msg  string
}

func (ErrEmpty) Error added in v1.8.0

func (e ErrEmpty) Error() string

type ErrInvalid added in v1.8.0

type ErrInvalid struct {
	Name  string
	Value any
	Msg   string
}

func NewErrDuplicate added in v1.10.0

func NewErrDuplicate(name string, value any) ErrInvalid

NewErrDuplicate returns an ErrInvalid with a standard duplicate message.

func (ErrInvalid) Error added in v1.8.0

func (e ErrInvalid) Error() string

type ErrMissing added in v1.8.0

type ErrMissing struct {
	Name string
	Msg  string
}

func (ErrMissing) Error added in v1.8.0

func (e ErrMissing) Error() string

type ExplorerSecrets added in v1.10.0

type ExplorerSecrets struct {
	AccessKey *models.Secret
	Secret    *models.Secret
}

type Feature

type Feature struct {
	FeedsManager *bool
	LogPoller    *bool
	UICSAKeys    *bool
}

type FluxMonitor

type FluxMonitor struct {
	DefaultTransactionQueueDepth *uint32
	SimulateTransactions         *bool
}

type JobPipeline

type JobPipeline struct {
	ExternalInitiatorsEnabled *bool
	MaxRunDuration            *models.Duration
	ReaperInterval            *models.Duration
	ReaperThreshold           *models.Duration
	ResultWriteQueueDepth     *uint32

	HTTPRequest JobPipelineHTTPRequest `toml:",omitempty"`
}

type JobPipelineHTTPRequest added in v1.10.0

type JobPipelineHTTPRequest struct {
	DefaultTimeout *models.Duration
	MaxSize        *utils.FileSize
}

type Keeper

type Keeper struct {
	DefaultTransactionQueueDepth *uint32
	GasPriceBufferPercent        *uint16
	GasTipCapBufferPercent       *uint16
	BaseFeeBufferPercent         *uint16
	MaxGracePeriod               *int64
	TurnLookBack                 *int64
	TurnFlagEnabled              *bool
	UpkeepCheckGasPriceEnabled   *bool

	Registry KeeperRegistry `toml:",omitempty"`
}

type KeeperRegistry added in v1.10.0

type KeeperRegistry struct {
	CheckGasOverhead    *uint32
	PerformGasOverhead  *uint32
	MaxPerformDataSize  *uint32
	SyncInterval        *models.Duration
	SyncUpkeepQueueSize *uint32
}

type Log

type Log struct {
	Level       *LogLevel
	JSONConsole *bool
	UnixTS      *bool

	File LogFile `toml:",omitempty"`
}

type LogFile added in v1.10.0

type LogFile struct {
	Dir        *string
	MaxSize    *utils.FileSize
	MaxAgeDays *int64
	MaxBackups *int64
}

type LogLevel added in v1.10.0

type LogLevel zapcore.Level

LogLevel replaces dpanic with crit/CRIT

func (LogLevel) CapitalString added in v1.10.0

func (l LogLevel) CapitalString() string

func (LogLevel) MarshalText added in v1.10.0

func (l LogLevel) MarshalText() ([]byte, error)

func (LogLevel) String added in v1.10.0

func (l LogLevel) String() string

func (*LogLevel) UnmarshalText added in v1.10.0

func (l *LogLevel) UnmarshalText(text []byte) error

type OCR

type OCR struct {
	Enabled                      *bool
	ObservationTimeout           *models.Duration
	BlockchainTimeout            *models.Duration
	ContractPollInterval         *models.Duration
	ContractSubscribeInterval    *models.Duration
	DefaultTransactionQueueDepth *uint32
	// Optional
	KeyBundleID          *models.Sha256Hash
	SimulateTransactions *bool
	TransmitterAddress   *ethkey.EIP55Address
}

type OCR2

type OCR2 struct {
	Enabled                            *bool
	ContractConfirmations              *uint32
	BlockchainTimeout                  *models.Duration
	ContractPollInterval               *models.Duration
	ContractSubscribeInterval          *models.Duration
	ContractTransmitterTransmitTimeout *models.Duration
	DatabaseTimeout                    *models.Duration
	KeyBundleID                        *models.Sha256Hash
}

type P2P

type P2P struct {
	IncomingMessageBufferSize *int64
	OutgoingMessageBufferSize *int64
	PeerID                    *p2pkey.PeerID
	TraceLogging              *bool

	V1 P2PV1 `toml:",omitempty"`
	V2 P2PV2 `toml:",omitempty"`
}

func (*P2P) NetworkStack

func (p *P2P) NetworkStack() ocrnetworking.NetworkingStack

type P2PV1

type P2PV1 struct {
	Enabled                          *bool
	AnnounceIP                       *net.IP
	AnnouncePort                     *uint16
	BootstrapCheckInterval           *models.Duration
	DefaultBootstrapPeers            *[]string
	DHTAnnouncementCounterUserPrefix *uint32
	DHTLookupInterval                *int64
	ListenIP                         *net.IP
	ListenPort                       *uint16
	NewStreamTimeout                 *models.Duration
	PeerstoreWriteInterval           *models.Duration
}

func (*P2PV1) ValidateConfig added in v1.9.0

func (p *P2PV1) ValidateConfig() (err error)

type P2PV2

type P2PV2 struct {
	Enabled              *bool
	AnnounceAddresses    *[]string
	DefaultBootstrappers *[]ocrcommontypes.BootstrapperLocator
	DeltaDial            *models.Duration
	DeltaReconcile       *models.Duration
	ListenAddresses      *[]string
}

type Passwords added in v1.10.0

type Passwords struct {
	Keystore *models.Secret
	VRF      *models.Secret
}

func (*Passwords) ValidateConfig added in v1.10.0

func (p *Passwords) ValidateConfig() (err error)

type Pyroscope added in v1.9.0

type Pyroscope struct {
	ServerAddress *string
	Environment   *string
}

type PyroscopeSecrets added in v1.10.0

type PyroscopeSecrets struct {
	AuthToken *models.Secret
}

type Secrets

type Secrets struct {
	Database  DatabaseSecrets  `toml:",omitempty"`
	Explorer  ExplorerSecrets  `toml:",omitempty"`
	Password  Passwords        `toml:",omitempty"`
	Pyroscope PyroscopeSecrets `toml:",omitempty"`
}

type Sentry

type Sentry struct {
	Debug       *bool
	DSN         *string
	Environment *string
	Release     *string
}

type TelemetryIngress

type TelemetryIngress struct {
	UniConn      *bool
	Logging      *bool
	ServerPubKey *string
	URL          *models.URL
	BufferSize   *uint16
	MaxBatchSize *uint16
	SendInterval *models.Duration
	SendTimeout  *models.Duration
	UseBatchSend *bool
}

type UniqueStrings added in v1.10.0

type UniqueStrings map[string]struct{}

UniqueStrings is a helper for tracking unique values in string form.

func (UniqueStrings) IsDupe added in v1.10.0

func (u UniqueStrings) IsDupe(s *string) bool

IsDupe returns true if the set already contains the string, otherwise false. Non-nil/empty strings are added to the set.

func (UniqueStrings) IsDupeFmt added in v1.10.0

func (u UniqueStrings) IsDupeFmt(t fmt.Stringer) bool

IsDupeFmt is like IsDupe, but calls String().

type Validated added in v1.8.0

type Validated interface {
	// ValidateConfig returns nil if the config is valid, otherwise an error describing why it is invalid.
	//
	// For implementations:
	//  - Use package multierr to accumulate all errors, rather than returning the first encountered.
	//  - If an anonymous field also implements ValidateConfig(), it must be called explicitly!
	ValidateConfig() error
}

Validated configurations impose constraints that must be checked.

type WebServer

type WebServer struct {
	AllowOrigins            *string
	BridgeResponseURL       *models.URL
	HTTPWriteTimeout        *models.Duration
	HTTPPort                *uint16
	SecureCookies           *bool
	SessionTimeout          *models.Duration
	SessionReaperExpiration *models.Duration

	MFA       WebServerMFA       `toml:",omitempty"`
	RateLimit WebServerRateLimit `toml:",omitempty"`
	TLS       WebServerTLS       `toml:",omitempty"`
}

type WebServerMFA

type WebServerMFA struct {
	RPID     *string
	RPOrigin *string
}

type WebServerRateLimit

type WebServerRateLimit struct {
	Authenticated         *int64
	AuthenticatedPeriod   *models.Duration
	Unauthenticated       *int64
	UnauthenticatedPeriod *models.Duration
}

type WebServerTLS

type WebServerTLS struct {
	CertPath      *string
	ForceRedirect *bool
	Host          *string
	HTTPSPort     *uint16
	KeyPath       *string
}

Directories

Path Synopsis
cmd/generate
Docs prints core node documentation and/or a list of errors.
Docs prints core node documentation and/or a list of errors.

Jump to

Keyboard shortcuts

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