config

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: May 21, 2025 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DefaultListenAddress = "0.0.0.0:8545"
	DefaultChainID       = "dev"
	DefaultMaxSendAmount = "1000000ugnot"
	//nolint:lll // Mnemonic is naturally long
	DefaultMnemonic    = "" /* 161-byte string literal not displayed */
	DefaultNumAccounts = uint64(1)
)

Variables

View Source
var (
	ErrInvalidListenAddress = errors.New("invalid listen address")
	ErrInvalidChainID       = errors.New("invalid chain ID")
	ErrInvalidSendAmount    = errors.New("invalid send amount")
	ErrInvalidMnemonic      = errors.New("invalid mnemonic")
	ErrInvalidNumAccounts   = errors.New("invalid number of faucet accounts")
)

Functions

func ValidateConfig

func ValidateConfig(config *Config) error

ValidateConfig validates the faucet configuration

Types

type CORS

type CORS struct {
	// A list of origins a cross-domain request can be executed from.
	// If the special '*' value is present in the list, all origins will be allowed.
	// An origin may contain a wildcard (*) to replace 0 or more characters (i.e.: http://*.domain.com).
	// Only one wildcard can be used per origin
	AllowedOrigins []string `toml:"cors_allowed_origins"`

	// A list of non-simple headers the client is allowed to use with cross-domain requests
	AllowedHeaders []string `toml:"cors_allowed_headers"`

	// A list of methods the client is allowed to use with cross-domain requests
	AllowedMethods []string `toml:"cors_allowed_methods"`
}

CORS defines the Faucet CORS configuration

func DefaultCORSConfig

func DefaultCORSConfig() *CORS

DefaultCORSConfig returns the default CORS configuration

type Config

type Config struct {
	// The associated CORS config, if any
	CORSConfig *CORS `toml:"cors_config"`

	// The address at which the faucet will be served.
	// Format should be: <IP>:<PORT>
	ListenAddress string `toml:"listen_address"`

	// The chain ID associated with the remote Gno chain
	ChainID string `toml:"chain_id"`

	// The mnemonic for the faucet
	Mnemonic string `toml:"mnemonic"`

	// The static max send amount (native currency).
	// Format should be: <AMOUNT>ugnot
	MaxSendAmount string `toml:"send_amount"`

	// The number of faucet accounts,
	// based on the mnemonic (account 0, index x)
	NumAccounts uint64 `toml:"num_accounts"`
}

Config defines the base-level Faucet configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default faucet configuration

Jump to

Keyboard shortcuts

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