config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package config implements the logic to read the config file (either default or user-supplied) and unmarshal it a struct for developer convenience.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

type Api struct {
	Server           *Server  `mapstructure:"server"`
	BasePath         string   `mapstructure:"base_path"`
	RegisterVersions []string `mapstructure:"register_versions"`
}

Api struct is used to store the contents of the 'api' property from the parsed config file.

func (*Api) Validate

func (c *Api) Validate() error

Validate runs validations against an instance of the Api struct and returns an error when applicable.

type Config

type Config struct {
	System              *System              `mapstructure:"system"`
	Api                 *Api                 `mapstructure:"api"`
	FaultDetectorConfig *FaultDetectorConfig `mapstructure:"fault_detector"`
	Notification        *Notification        `mapstructure:"notification"`
}

Config struct is used to store the contents of the parsed config file. The properties (sub-properties) should map on-to-one with the config file.

func (*Config) Validate

func (c *Config) Validate() error

Validate runs validations against an instance of the Config struct and returns an error when applicable.

type FaultDetectorConfig

type FaultDetectorConfig struct {
	L1RPCEndpoint                 string `mapstructure:"l1_rpc_endpoint"`
	L2RPCEndpoint                 string `mapstructure:"l2_rpc_endpoint"`
	StartBatchIndex               int64  `mapstructure:"start_batch_index"`
	L2OutputOracleContractAddress string `mapstructure:"l2_output_oracle_contract_address"`
}

FaultDetector struct is used to store the contents of the 'fault_detector' property from the parsed config file.

func (*FaultDetectorConfig) Validate

func (c *FaultDetectorConfig) Validate() error

Validate runs validations against an instance of the FaultDetector struct and returns an error when applicable.

type Notification

type Notification struct {
	Slack  *SlackConfig `mapstructure:"slack"`
	Enable bool         `mapstructure:"enable"`
}

Notification struct is used to store notification configurations from the parsed config file.

func (*Notification) Validate

func (c *Notification) Validate() error

Validate runs validations against an instance of the Notification struct and returns an error when applicable.

type Server

type Server struct {
	Host string `mapstructure:"host"`
	Port uint   `mapstructure:"port"`
}

Server struct is used to store the contents of the 'api.server' sub-property from the parsed config file.

func (*Server) Validate

func (c *Server) Validate() error

Validate runs validations against an instance of the Server struct and returns an error when applicable.

type SlackConfig

type SlackConfig struct {
	ChannelID string `mapstructure:"channel_id"`
}

SlackConfig struct is used to store slack configurations from the parsed config file.

type System

type System struct {
	LogLevel string `mapstructure:"log_level"`
}

System struct is used to store the contents of the 'system' property from the parsed config file.

func (*System) Validate

func (c *System) Validate() error

Validate runs validations against an instance of the System struct and returns an error when applicable.

Jump to

Keyboard shortcuts

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