config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlagConfigPath          = "config-path"
	FlagConfigType          = "config-type"
	FlagConfigAwsRegion     = "aws-region"
	FlagConfigAwsSecretKey  = "aws-secret-key"
	FlagConfigPrivateKey    = "private-key"
	FlagConfigBlsPrivateKey = "bls-private-key"
	FlagConfigDbPass        = "db-pass"

	DBDialectMysql   = "mysql"
	DBDialectSqlite3 = "sqlite3"

	LocalConfig            = "local"
	AWSConfig              = "aws"
	KeyTypeLocalPrivateKey = "local_private_key"
	KeyTypeAWSPrivateKey   = "aws_private_key"

	ConfigType     = "CONFIG_TYPE"
	ConfigFilePath = "CONFIG_FILE_PATH"
)

Variables

This section is empty.

Functions

func GetSecret

func GetSecret(secretName, region string) (string, error)

Types

type AlertConfig

type AlertConfig struct {
	Identity       string `json:"identity"`
	TelegramBotId  string `json:"telegram_bot_id"`
	TelegramChatId string `json:"telegram_chat_id"`
}

type Config

type Config struct {
	GreenfieldConfig GreenfieldConfig `json:"greenfield_config"`
	LogConfig        LogConfig        `json:"log_config"`
	AlertConfig      AlertConfig      `json:"alert_config"`
	DBConfig         DBConfig         `json:"db_config"`
	MetricsConfig    MetricsConfig    `json:"metrics_config"`
	SPConfig         SPConfig         `json:"sp_config"`
}

func ParseConfigFromFile

func ParseConfigFromFile(filePath string) *Config

func ParseConfigFromJson

func ParseConfigFromJson(content string) *Config

func (*Config) Validate

func (cfg *Config) Validate()

type DBConfig

type DBConfig struct {
	Dialect       string `json:"dialect"`
	DBPath        string `json:"db_path"`
	KeyType       string `json:"key_type"`
	AWSRegion     string `json:"aws_region"`
	AWSSecretName string `json:"aws_secret_name"`
	Password      string `json:"password"`
	Username      string `json:"username"`
	MaxIdleConns  int    `json:"max_idle_conns"`
	MaxOpenConns  int    `json:"max_open_conns"`
	DebugMode     bool   `json:"debug_mode"`
}

func (*DBConfig) Validate

func (cfg *DBConfig) Validate()

type GreenfieldConfig

type GreenfieldConfig struct {
	KeyType          string   `json:"key_type"`
	AWSRegion        string   `json:"aws_region"`
	AWSSecretName    string   `json:"aws_secret_name"`
	AWSBlsSecretName string   `json:"aws_bls_secret_name"`
	PrivateKey       string   `json:"private_key"`
	BlsPrivateKey    string   `json:"bls_private_key"`
	RPCAddrs         []string `json:"rpc_addrs"`
	ChainIdString    string   `json:"chain_id_string"`
	GasLimit         uint64   `json:"gas_limit"`
	FeeAmount        string   `json:"fee_amount"`
	FeeDenom         string   `json:"fee_denom"`
}

func (*GreenfieldConfig) Validate added in v0.0.2

func (cfg *GreenfieldConfig) Validate()

type LogConfig

type LogConfig struct {
	Level                        string `json:"level"`
	Filename                     string `json:"filename"`
	MaxFileSizeInMB              int    `json:"max_file_size_in_mb"`
	MaxBackupsOfLogFiles         int    `json:"max_backups_of_log_files"`
	MaxAgeToRetainLogFilesInDays int    `json:"max_age_to_retain_log_files_in_days"`
	UseConsoleLogger             bool   `json:"use_console_logger"`
	UseFileLogger                bool   `json:"use_file_logger"`
	Compress                     bool   `json:"compress"`
}

func (*LogConfig) Validate

func (cfg *LogConfig) Validate()

type MetricsConfig added in v0.0.4

type MetricsConfig struct {
	Port uint16 `json:"port"`
}

func (*MetricsConfig) Validate added in v0.0.4

func (cfg *MetricsConfig) Validate()

type SPConfig added in v1.1.0

type SPConfig struct {
	InternalSPEndpoints []string `json:"internal_sp_endpoints"`
}

Jump to

Keyboard shortcuts

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