config

package
v0.9.13 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load[T any](configPaths []string, envPrefix string) (*T, error)

Types

type AML

type AML struct {
	CheckInterval time.Duration `yaml:"check_interval" default:"2m"`
	CheckTimeout  time.Duration `yaml:"check_timeout" default:"30s"`
	MaxAttempts   int32         `yaml:"max_attempts" default:"5"`

	BitOK  BitOK  `yaml:"bit_ok" required:"true"`
	AMLBot AMLBot `yaml:"aml_bot" required:"true"`
}

type AMLBot

type AMLBot struct {
	Enabled bool   `yaml:"enabled" default:"true"`
	BaseURL string `yaml:"base_url" default:"https://extrnlapiendpoint.silencatech.com/"`
}

type AdminConfig

type AdminConfig struct {
	BaseURL             string        `yaml:"base_url" default:"https://api.dv.net/"`
	PingVersionInterval time.Duration `yaml:"ping_version_interval" default:"1h"`
	LogStatus           bool          `yaml:"log_status" default:"false"`
}

type AppConfig

type AppConfig struct {
	Profile models.AppProfile `yaml:"profile" default:"prod" validate:"oneof=dev prod demo"`
}

type BitOK

type BitOK struct {
	Enabled bool   `yaml:"enabled" default:"true"`
	BaseURL string `yaml:"base_url" default:"https://kyt-api.bitok.org/"`
}

type BitcoinBlockchain

type BitcoinBlockchain struct {
	AddressType string `` /* 135-byte string literal not displayed */
}

type Blockchain

type Blockchain struct {
	Bitcoin  BitcoinBlockchain
	Litecoin LitecoinBlockchain
	Dogecoin DogecoinBlockchain
}

type Config

type Config struct {
	RolesModelPath      string              `yaml:"roles_model_path" required:"true" default:"configs/rbac_model.conf"`
	RolesPoliciesPath   string              `yaml:"roles_policies_path" required:"true" default:"configs/rbac_policies.csv"`
	App                 AppConfig           `yaml:"app"`
	HTTP                HTTPConfig          `yaml:"http"`
	Seed                SeedConfig          `yaml:"seed"`
	Postgres            PostgresDB          `yaml:"postgres"`
	Redis               RedisDB             `yaml:"redis"`
	Exrate              ExrateConfig        `yaml:"exrate"`
	Admin               AdminConfig         `yaml:"admin"`
	Notify              NotifyConfig        `yaml:"notify"`
	WebHook             WebHook             `yaml:"web_hook"`
	EProxy              EProxy              `yaml:"e_proxy"`
	Transfers           Transfers           `yaml:"transfers"`
	Ops                 ops.Config          `yaml:"ops"`
	KeyValue            KeyValue            `yaml:"key_value"`
	Transactions        Transactions        `yaml:"transactions"`
	Wallets             Wallets             `yaml:"wallets"`
	ExternalStoreLimits ExternalStoreLimits `yaml:"external_store_limits"`
	Log                 logger.Config       `yaml:"log"`
	Blockchain          Blockchain          `yaml:"blockchain"`
	Updater             Updater             `yaml:"updater"`
	Turnstile           Turnstile           `yaml:"turnstile"`
	AML                 AML                 `yaml:"aml"`
}

type DogecoinBlockchain

type DogecoinBlockchain struct {
	AddressType string `json:"address_type" yaml:"address_type" usage:"change default generate address" default:"P2PKH" example:"P2PKH"`
}

type EProxy

type EProxy struct {
	GRPC GrpcConfig `yaml:"grpc"`
}

type ExrateConfig

type ExrateConfig struct {
	FetchInterval time.Duration `yaml:"fetch_interval" env:"FETCH_INTERVAL" default:"1m"`
}

type ExternalStoreLimits

type ExternalStoreLimits struct {
	Enabled                bool          `yaml:"enabled" default:"false"`
	RateLimitInterval      time.Duration `yaml:"rate_limit_interval" default:"24h"`
	MaxRequestsPerInterval int64         `yaml:"max_requests_per_interval" default:"3"`
}

type GrpcConfig

type GrpcConfig struct {
	Name string `default:"connectrpc-client" validate:"required" example:"backend-connectrpc-client"`
	Addr string `default:"https://explorer-proxy.dv.net" validate:"required" usage:"connectrpc server address" example:"localhost:9000"`
}

type HTTPConfig

type HTTPConfig struct {
	Host               string         `yaml:"host" default:"localhost"`
	Port               string         `yaml:"port" default:"80"`
	FetchInterval      time.Duration  `yaml:"fetch_interval" env:"FETCH_INTERVAL" default:"30s"`
	ConnectTimeout     time.Duration  `yaml:"connect_timeout" env:"CONNECT_TIMEOUT" default:"5s"`
	ReadTimeout        time.Duration  `yaml:"read_timeout" env:"READ_TIMEOUT" default:"10s"`
	WriteTimeout       time.Duration  `yaml:"write_timeout" env:"WRITE_TIMEOUT" default:"10s"`
	MaxHeaderMegabytes int            `yaml:"max_header_megabytes" env:"MAX_HEADER_MEGABYTES" default:"1"`
	Cors               HTTPCorsConfig `yaml:"cors"`
}

type HTTPCorsConfig

type HTTPCorsConfig struct {
	Enabled        bool     `yaml:"enabled" default:"true" usage:"allows to disable cors" example:"true / false"`
	AllowedOrigins []string `yaml:"allowed_origins"`
}

type KeyValue

type KeyValue struct {
	Engine KeyValueEngine `yaml:"engine" required:"true" validate:"oneof=redis in_memory" example:"redis / in_memory" default:"redis"`
}

type KeyValueEngine

type KeyValueEngine string
const (
	KeyValueEngineInMemory KeyValueEngine = "in_memory"
	KeyValueEngineRedis    KeyValueEngine = "redis"
)

type LitecoinBlockchain

type LitecoinBlockchain struct {
	AddressType string `` /* 135-byte string literal not displayed */
}

type NotifyConfig

type NotifyConfig struct {
	Telegram NotifyTelegram `yaml:"telegram"`
}

type NotifyTelegram

type NotifyTelegram struct {
	Enabled bool   `yaml:"enabled" default:"false"`
	Token   string `yaml:"token" secret:"true"`
}

type PostgresDB

type PostgresDB struct {
	Addr            string `validate:"required" usage:"storage address in format ip:port"`
	DBName          string `yaml:"db_name" env:"DB_NAME" validate:"required"  usage:"storage user"`
	User            string `validate:"required" secret:"true" usage:"storage user password"`
	Password        string `validate:"required" secret:"true" usage:"storage db name"`
	ConnMaxLifetime int    `yaml:"conn_max_lifetime" default:"180"`
	MaxOpenConns    int32  `yaml:"max_open_conns" default:"100"`
	MaxIdleConns    int32  `yaml:"max_idle_conns" default:"100"`
	MinOpenConns    int32  `yaml:"min_open_conns" default:"6"`
}

func (PostgresDB) DSN

func (conf PostgresDB) DSN() string

func (PostgresDB) Engine

func (conf PostgresDB) Engine() string

type RedisDB

type RedisDB struct {
	Addr     string `yaml:"addr" usage:"storage address in format ip:port"`
	User     string `secret:"true" usage:"storage user password"`
	Password string `secret:"true" usage:"storage db name"`
	DBIndex  int    `yaml:"db_index" usage:"index of database"`
}

func (RedisDB) URL

func (r RedisDB) URL() string

type SeedConfig

type SeedConfig struct {
	Base string `yaml:"base" default:"seeds"`
}

type Transactions

type Transactions struct {
	UnconfirmedCollapseInterval time.Duration `yaml:"unconfirmed_collapse_interval" default:"30s"`
}

type Transfers

type Transfers struct {
	GroupSize int `yaml:"group_size" default:"5"`
}

type Turnstile

type Turnstile struct {
	Enabled bool   `yaml:"enabled" default:"false"`
	Secret  string `yaml:"secret"`
	SiteKey string `yaml:"site_key"`
	BaseURL string `yaml:"base_url" default:"https://challenges.cloudflare.com"`
}

type Updater

type Updater struct {
	BaseURL string `` /* 142-byte string literal not displayed */
}

type Wallets

type Wallets struct {
	UpdateBalancesInterval      time.Duration `yaml:"update_balances_interval" default:"2s"`
	UpdateTronResourcesInterval time.Duration `yaml:"update_tron_resources_interval" default:"1h"`
}

type WebHook

type WebHook struct {
	MaxTries int `yaml:"max_tries" default:"30"`
}

Jump to

Keyboard shortcuts

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