config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPort

func GetPort() string

GetPort returns port from configuration

func GetSolanaFilePath

func GetSolanaFilePath() string

GetSolanaFilePath returns path to .cwt file from configuration

func GetSolanaPasswordBytes

func GetSolanaPasswordBytes() ([]byte, error)

GetSolanaPasswordBytes returns the password stored in memory (from PromptForPassword). Returns an error if the password was not set. Caller must zero the returned slice after use for security.

func GetSolanaRPCURL

func GetSolanaRPCURL() string

GetSolanaRPCURL returns Solana RPC URL from configuration

func Init

func Init() error

Init loads configuration from environment variables.

func PromptForPassword

func PromptForPassword() error

PromptForPassword prompts the user for the wallet password in the terminal. The password is read without echoing (hidden input) and stored in memory. Call this at startup before the server begins handling requests.

Types

type Config

type Config struct {
	Port           string `envconfig:"PORT" default:"8080"`
	SolanaFilePath string `envconfig:"SOLANA_FILE_PATH" required:"true"`
	SolanaRPCURL   string `envconfig:"SOLANA_RPC_URL" default:"https://api.mainnet-beta.solana.com"`
}

Config contains all configuration parameters for the application. Note: Password is prompted at runtime and stored in memory - use GetSolanaPasswordBytes()

func Get

func Get() *Config

Get returns the global configuration instance. Panics if Init() was not called.

Jump to

Keyboard shortcuts

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