config

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Save

func Save(cfg *Config, basePath string) error

Save writes the given config to <NodeDir>/config/pushuv_config.json.

Types

type ChainSpecificConfig

type ChainSpecificConfig struct {
	// RPC Configuration
	RPCURLs []string `json:"rpc_urls,omitempty"` // RPC endpoints for this chain

	// Transaction Cleanup Configuration
	CleanupIntervalSeconds *int `json:"cleanup_interval_seconds,omitempty"` // How often to run cleanup for this chain (optional, uses global default if not set)
	RetentionPeriodSeconds *int `json:"retention_period_seconds,omitempty"` // How long to keep confirmed transactions for this chain (optional, uses global default if not set)

	// Event Monitoring Configuration
	EventPollingIntervalSeconds *int `json:"event_polling_interval_seconds,omitempty"` // How often to poll for new events for this chain (optional, uses global default if not set)

	// Event Start Cursor
	// If set to a non-negative value, gateway event watchers start from this
	// block/slot for this chain. If set to -1 or not present, start from the
	// latest block/slot (or from DB resume point when available).
	EventStartFrom *int64 `json:"event_start_from,omitempty"`
}

ChainSpecificConfig holds all chain-specific configuration in one place

type Config

type Config struct {
	// Log Config
	LogLevel   int    `json:"log_level"`   // e.g., 0 = debug, 1 = info, etc.
	LogFormat  string `json:"log_format"`  // "json" or "console"
	LogSampler bool   `json:"log_sampler"` // if true, samples logs (e.g., 1 in 5)

	// Push Chain configuration
	PushChainID                  string   `json:"push_chain_id"`                   // Push Chain chain ID (default: localchain_9000-1)
	PushChainGRPCURLs            []string `json:"push_chain_grpc_urls"`            // Push Chain gRPC endpoints (default: ["localhost:9090"])
	ConfigRefreshIntervalSeconds int      `json:"config_refresh_interval_seconds"` // How often to refresh configs in seconds (default: 60)
	MaxRetries                   int      `json:"max_retries"`                     // Max retry attempts for registry queries (default: 3)
	RetryBackoffSeconds          int      `json:"retry_backoff_seconds"`           // Initial retry backoff duration in seconds (default: 1)

	// Startup configuration
	InitialFetchRetries        int `json:"initial_fetch_retries"`         // Number of retries for initial config fetch (default: 5)
	InitialFetchTimeoutSeconds int `json:"initial_fetch_timeout_seconds"` // Timeout per initial fetch attempt in seconds (default: 30)

	QueryServerPort int `json:"query_server_port"` // Port for HTTP query server (default: 8080)

	// Keyring configuration
	KeyringBackend KeyringBackend `json:"keyring_backend"` // Keyring backend type (file/test)

	// Event monitoring configuration
	EventPollingIntervalSeconds int `json:"event_polling_interval_seconds"` // How often to poll for new events in seconds (default: 5)

	// Database configuration
	DatabaseBaseDir string `json:"database_base_dir"` // Base directory for chain databases (default: ~/.puniversal/databases)

	// Transaction cleanup configuration (global defaults)
	TransactionCleanupIntervalSeconds int `json:"transaction_cleanup_interval_seconds"` // Global default: How often to run cleanup in seconds (default: 3600)
	TransactionRetentionPeriodSeconds int `json:"transaction_retention_period_seconds"` // Global default: How long to keep confirmed transactions in seconds (default: 86400)

	// RPC Pool configuration
	RPCPoolConfig RPCPoolConfig `json:"rpc_pool_config"` // RPC pool configuration

	// Unified per-chain configuration
	ChainConfigs map[string]ChainSpecificConfig `json:"chain_configs"` // Map of chain ID to all chain-specific settings

	// TSS Node configuration
	TSSP2PPrivateKeyHex string `json:"tss_p2p_private_key_hex"` // Ed25519 private key in hex for libp2p identity
	TSSP2PListen        string `json:"tss_p2p_listen"`          // libp2p listen address (default: /ip4/0.0.0.0/tcp/39000)
	TSSPassword         string `json:"tss_password"`            // Encryption password for keyshares
	TSSHomeDir          string `json:"tss_home_dir"`            // Keyshare storage directory (default: ~/.puniversal/tss)
}

func Load

func Load(basePath string) (Config, error)

Load reads and returns the config from <BasePath>/config/pushuv_config.json.

func LoadDefaultConfig

func LoadDefaultConfig() (Config, error)

LoadDefaultConfig loads the default configuration from the embedded JSON

func (*Config) GetChainCleanupSettings

func (c *Config) GetChainCleanupSettings(chainID string) (cleanupInterval, retentionPeriod int)

GetChainCleanupSettings returns cleanup settings for a specific chain Falls back to global defaults if no chain-specific settings exist

func (*Config) GetChainConfig

func (c *Config) GetChainConfig(chainID string) *ChainSpecificConfig

GetChainConfig returns the complete configuration for a specific chain

type KeyringBackend

type KeyringBackend string

KeyringBackend represents the type of keyring backend to use

const (
	// KeyringBackendTest is the test Cosmos keyring backend (unencrypted)
	KeyringBackendTest KeyringBackend = "test"

	// KeyringBackendFile is the file Cosmos keyring backend (encrypted)
	KeyringBackendFile KeyringBackend = "file"
)

type RPCPoolConfig

type RPCPoolConfig struct {
	HealthCheckIntervalSeconds int    `json:"health_check_interval_seconds"` // How often to check endpoint health in seconds (default: 30)
	UnhealthyThreshold         int    `json:"unhealthy_threshold"`           // Consecutive failures before marking unhealthy (default: 3)
	RecoveryIntervalSeconds    int    `json:"recovery_interval_seconds"`     // How long to wait before retesting excluded endpoint in seconds (default: 300)
	MinHealthyEndpoints        int    `json:"min_healthy_endpoints"`         // Minimum healthy endpoints required (default: 1)
	RequestTimeoutSeconds      int    `json:"request_timeout_seconds"`       // Timeout for individual RPC requests in seconds (default: 10)
	LoadBalancingStrategy      string `json:"load_balancing_strategy"`       // "round-robin" or "weighted" (default: "round-robin")
}

RPCPoolConfig holds configuration for RPC endpoint pooling

Jump to

Keyboard shortcuts

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