config

package
v0.0.0-...-c01c563 Latest Latest
Warning

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

Go to latest
Published: May 5, 2025 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnvBool

func GetEnvBool(key string, required bool, defaultValue bool) bool

func GetEnvBytes

func GetEnvBytes(key string, required bool) []byte

func GetEnvString

func GetEnvString(key string, required bool) string

func GetEnvStringsArray

func GetEnvStringsArray(key string, required bool) []string

func GetSecureBytesEnv

func GetSecureBytesEnv(key string, required bool) *sbytes.SecureBytes

func GetSecureStringEnv

func GetSecureStringEnv(key string, required bool) *sstring.SecureString

Types

type AppConfig

type AppConfig struct {
	// DirPath is the path to the directory where all files for this application are saved.
	DirPath string

	HMACSecret *sbytes.SecureBytes
	AppSecret  *sstring.SecureString

	// HTTPAddress is the address and port that the HTTP JSON API server will listen on.
	// Do not expose to the public!
	HTTPAddress string

	GeoLiteDBPath   string
	BannedCountries []string
}

AppConfig represents the configuration for the application. It contains settings for the directory path, HTTP address, and RPC address.

type BlockchainConfig

type BlockchainConfig struct {
	// ChainID is the unique ID for this blockchain instance.
	ChainID uint16 `json:"chain_id"`
}

BlockchainConfig represents the configuration for the blockchain. It contains settings for the chain ID, transactions per block, difficulty, mining reward, gas price, and units of gas.

type Config

type Config struct {
	// Blockchain configuration.
	Blockchain BlockchainConfig

	// Application configuration.
	App AppConfig

	// Database configuration.
	DB DBConfig

	// Peer configuration.
	Peer PeerConfig

	// IPFS configuration.
	IPFS IPFSConfig
}

Config represents the configuration for the application. It contains settings for the blockchain, application, database, and peer connections.

type DBConfig

type DBConfig struct {
	// DataDir is the location of the database files.
	DataDir string
}

DBConfig represents the configuration for the database. It contains the location of the database files.

type IPFSConfig

type IPFSConfig struct {
	// RemoteIP is the IP address of the peer node running IPFS.
	RemoteIP string

	// RemotePort is the port to the peer node running IPFS.
	RemotePort string

	// PublicGatewayDomain is the HTTP domain to use as a fall-back if peer node is not running.
	PublicGatewayDomain string
}

type PeerConfig

type PeerConfig struct {
	// ListenPort is the port that the peer will listen on.
	ListenPort int

	// KeyName is the name of the key used for encryption.
	KeyName string

	// RendezvousString is the string used for rendezvous connections.
	RendezvousString string

	// BootstrapPeers is a list of multiaddresses for bootstrap peers.
	BootstrapPeers []maddr.Multiaddr

	// ListenAddresses is a list of multiaddresses that the peer will listen on.
	ListenAddresses []maddr.Multiaddr
}

PeerConfig represents the configuration for peer connections. It contains settings for the listen port, key name, rendezvous string, bootstrap peers, and listen addresses.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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