util

package
v1.0.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: LGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyTypeMnemonic    = "mnemonic"
	KeyTypeAWSMnemonic = "aws_mnemonic"
)

Variables

View Source
var (
	// Logger instance for quick declarative logging levels
	Logger    = logging.MustGetLogger("deputy")
	SdkLogger = &sdkLogger{}
)

Functions

func GetS3Object

func GetS3Object(region string, bucket string, key string) (string, error)

func GetSecret

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

func InitLogger

func InitLogger(config LogConfig)

InitLogger initialises the logger.

func SendTelegramMessage

func SendTelegramMessage(botId string, chatId string, msg string)

Types

type AdminConfig

type AdminConfig struct {
	ListenAddr string `json:"listen_addr"`
}

type AlertConfig

type AlertConfig struct {
	Moniker        string `json:"moniker"`
	TelegramBotId  string `json:"telegram_bot_id"`
	TelegramChatId string `json:"telegram_chat_id"`

	BlockUpdateTimeOut int64 `json:"block_update_time_out"`
}

type ChainConfig

type ChainConfig struct {
	BSCStartHeight                 int64          `json:"bsc_start_height"`
	BSCProvider                    string         `json:"bsc_provider"`
	BSCConfirmNum                  int64          `json:"bsc_confirm_num"`
	BSCChainId                     string         `json:"bsc_chain_id"`
	BSCTokenHubContractAddress     ethcmm.Address `json:"bsc_token_hub_contract_address"`
	BSCValidatorSetContractAddress ethcmm.Address `json:"bsc_validator_set_contract_address"`

	BBCRpcAddr       string `json:"bbc_rpc_addr"`
	BBCMnemonic      string `json:"bbc_mnemonic"`
	BBCKeyType       string `json:"bbc_key_type"`
	BBCAWSRegion     string `json:"bbc_aws_region"`
	BBCAWSSecretName string `json:"bbc_aws_secret_name"`
}

func (*ChainConfig) Validate

func (cfg *ChainConfig) Validate()

type Config

type Config struct {
	DBConfig    *DBConfig    `json:"db_config"`
	ChainConfig *ChainConfig `json:"chain_config"`
	LogConfig   *LogConfig   `json:"log_config"`
	AlertConfig *AlertConfig `json:"alert_config"`
	AdminConfig *AdminConfig `json:"admin_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"`
}

func (*DBConfig) Validate

func (cfg *DBConfig) 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()

Jump to

Keyboard shortcuts

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