config

package
v0.0.0-...-2b2340b Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BTCAddressByChainConfigs = map[string]*chaincfg.Params{
	"bitcoin-regtest": &chaincfg.RegressionNetParams,
	"bitcoin-testnet": &chaincfg.TestNet3Params,
	"bitcoin-mainnet": &chaincfg.MainNetParams,
	"bitcoin-simnet":  &chaincfg.SimNetParams,
}

TODO: Fix chain following https://github.com/satoshilabs/slips/blob/master/slip-0044.md

Functions

func GetTaprootAddress

func GetTaprootAddress(chain string, pubkeyX string) (string, error)

Types

type Config

type Config struct {
	Server ServerConfig `mapstructure:"server"`
	// TODO: Refactor db config
	ScalarDb  PostgresDBConfig `mapstructure:"db"`
	Metrics   MetricsConfig    `mapstructure:"metrics"`
	InitDApps InitDAppsConfig
}

func New

func New(cfgFile string) (*Config, error)

New returns a fully parsed Config object from a given file directory

func (*Config) Validate

func (cfg *Config) Validate() error

type InitDAppsConfig

type InitDAppsConfig struct {
	Env                string
	ConfigChainsPath   string
	RuntimeChainsPath  string
	ProtocolAddressHex string
	ProtocolPubKeyHex  string
	EvmFileName        string
	AddressesFileName  string
}

func (*InitDAppsConfig) ReadConfig

func (cfg *InitDAppsConfig) ReadConfig() error

type MetricsConfig

type MetricsConfig struct {
	// IP of the prometheus server
	Host string `mapstructure:"host"`
	// Port of the prometheus server
	Port int `mapstructure:"port"`
}

MetricsConfig defines the server's metric configuration

func DefaultMetricsConfig

func DefaultMetricsConfig() MetricsConfig

func (*MetricsConfig) GetMetricsPort

func (cfg *MetricsConfig) GetMetricsPort() int

func (*MetricsConfig) Validate

func (cfg *MetricsConfig) Validate() error

type PostgresDBConfig

type PostgresDBConfig struct {
	DbName   string `mapstructure:"db-name"`
	Host     string `mapstructure:"host"`
	Port     int    `mapstructure:"port"`
	User     string `mapstructure:"user"`
	Password string `mapstructure:"password"`
	LogLevel string `mapstructure:"log-level"`
}

func (*PostgresDBConfig) Validate

func (cfg *PostgresDBConfig) Validate() error

type ServerConfig

type ServerConfig struct {
	Host                string        `mapstructure:"host"`
	Port                int           `mapstructure:"port"`
	WriteTimeout        time.Duration `mapstructure:"write-timeout"`
	ReadTimeout         time.Duration `mapstructure:"read-timeout"`
	IdleTimeout         time.Duration `mapstructure:"idle-timeout"`
	AllowedOrigins      []string      `mapstructure:"allowed-origins"`
	BTCNet              string        `mapstructure:"btc-net"`
	LogLevel            string        `mapstructure:"log-level"`
	MaxContentLength    int64         `mapstructure:"max-content-length"`
	HealthCheckInterval int           `mapstructure:"health-check-interval"`

	BTCNetParam *chaincfg.Params
}

func (*ServerConfig) Validate

func (cfg *ServerConfig) Validate() error

func (*ServerConfig) ValidateServerLogLevel

func (cfg *ServerConfig) ValidateServerLogLevel() error

Jump to

Keyboard shortcuts

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