config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutomationConfig

type AutomationConfig struct {
	MaxTriggers int `mapstructure:"max_triggers"`
	MinInterval int `mapstructure:"min_interval"`
}

AutomationConfig represents the automation service configuration

type BlockchainConfig

type BlockchainConfig struct {
	Network     string `mapstructure:"network"`
	RPCEndpoint string `mapstructure:"rpc_endpoint"`
	WSEndpoint  string `mapstructure:"ws_endpoint"`
	PrivateKey  string `mapstructure:"private_key"`
}

BlockchainConfig represents the blockchain configuration

type CORSConfig

type CORSConfig struct {
	AllowedOrigins []string `mapstructure:"allowed_origins"`
	AllowedMethods []string `mapstructure:"allowed_methods"`
	AllowedHeaders []string `mapstructure:"allowed_headers"`
	MaxAge         int      `mapstructure:"max_age"`
}

CORSConfig represents the CORS configuration

type Config

type Config struct {
	Environment string           `mapstructure:"environment"`
	Server      ServerConfig     `mapstructure:"server"`
	Database    DatabaseConfig   `mapstructure:"database"`
	Blockchain  BlockchainConfig `mapstructure:"blockchain"`
	Functions   FunctionsConfig  `mapstructure:"functions"`
	Secrets     SecretsConfig    `mapstructure:"secrets"`
	Oracle      OracleConfig     `mapstructure:"oracle"`
	PriceFeed   PriceFeedConfig  `mapstructure:"price_feed"`
	Automation  AutomationConfig `mapstructure:"automation"`
	GasBank     GasBankConfig    `mapstructure:"gas_bank"`
	TEE         TEEConfig        `mapstructure:"tee"`
	Monitoring  MonitoringConfig `mapstructure:"monitoring"`
}

Config represents the application configuration

func Load

func Load() (*Config, error)

Load loads configuration from file and environment variables

func New

func New() *Config

New creates a new config instance with default values

type DatabaseConfig

type DatabaseConfig struct {
	Driver          string `mapstructure:"driver"`
	DSN             string `mapstructure:"dsn"`
	MaxOpenConns    int    `mapstructure:"max_open_conns"`
	MaxIdleConns    int    `mapstructure:"max_idle_conns"`
	ConnMaxLifetime int    `mapstructure:"conn_max_lifetime"`
}

DatabaseConfig represents the database configuration

func (DatabaseConfig) ConnectionString

func (c DatabaseConfig) ConnectionString() string

ConnectionString returns a PostgreSQL connection string

type FunctionsConfig

type FunctionsConfig struct {
	MaxMemory        int `mapstructure:"max_memory"`
	ExecutionTimeout int `mapstructure:"execution_timeout"`
	MaxConcurrency   int `mapstructure:"max_concurrency"`
}

FunctionsConfig represents the functions configuration

type GasBankConfig

type GasBankConfig struct {
	MaxWithdrawal string `mapstructure:"max_withdrawal"`
	FeePercentage int    `mapstructure:"fee_percentage"`
}

GasBankConfig represents the gas bank service configuration

type MonitoringConfig

type MonitoringConfig struct {
	Enabled         bool   `mapstructure:"enabled"`
	PrometheusPort  int    `mapstructure:"prometheus_port"`
	MetricsEndpoint string `mapstructure:"metrics_endpoint"`
}

MonitoringConfig represents the monitoring configuration

type OracleConfig

type OracleConfig struct {
	UpdateInterval int `mapstructure:"update_interval"`
	MaxDataSources int `mapstructure:"max_data_sources"`
}

OracleConfig represents the oracle service configuration

type PriceFeedConfig

type PriceFeedConfig struct {
	UpdateInterval int               `mapstructure:"update_interval"`
	Sources        map[string]string `mapstructure:"sources"`
}

PriceFeedConfig represents the price feed service configuration

type RateLimitConfig

type RateLimitConfig struct {
	Enabled        bool  `mapstructure:"enabled"`
	RequestsPerIP  int   `mapstructure:"requests_per_ip"`
	RequestsPerKey int   `mapstructure:"requests_per_key"`
	BurstIP        int   `mapstructure:"burst_ip"`
	BurstKey       int   `mapstructure:"burst_key"`
	TimeWindowSec  int64 `mapstructure:"time_window_sec"`
}

RateLimitConfig represents the rate limiting configuration

type SecretsConfig

type SecretsConfig struct {
	KMSProvider string `mapstructure:"kms_provider"`
	KeyID       string `mapstructure:"key_id"`
	Region      string `mapstructure:"region"`
}

SecretsConfig represents the secrets configuration

type ServerConfig

type ServerConfig struct {
	Host         string          `mapstructure:"host"`
	Port         int             `mapstructure:"port"`
	ReadTimeout  time.Duration   `mapstructure:"read_timeout"`
	WriteTimeout time.Duration   `mapstructure:"write_timeout"`
	IdleTimeout  time.Duration   `mapstructure:"idle_timeout"`
	RateLimit    RateLimitConfig `mapstructure:"rate_limit"`
	CORS         CORSConfig      `mapstructure:"cors"`
	Mode         string          `mapstructure:"mode"`
	Timeout      int             `mapstructure:"timeout"`
}

ServerConfig represents the server configuration

func (ServerConfig) IsDevelopment

func (c ServerConfig) IsDevelopment() bool

IsDevelopment returns true if the server is in development mode

func (ServerConfig) IsProduction

func (c ServerConfig) IsProduction() bool

IsProduction returns true if the server is in production mode

type TEEConfig

type TEEConfig struct {
	Enabled             bool   `mapstructure:"enabled"`
	Provider            string `mapstructure:"provider"`
	AttestationEndpoint string `mapstructure:"attestation_endpoint"`
}

TEEConfig represents the TEE configuration

Jump to

Keyboard shortcuts

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