config

package
v0.10.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package config provides types and functions for node configuration loading and generation.

Index

Constants

View Source
const (
	DefaultTLSCertFileName = "rpc.cert"
)

Variables

View Source
var ErrConfigFileNotFound = fmt.Errorf("config file not found")

Functions

func AddConfigFlags

func AddConfigFlags(flagSet *pflag.FlagSet, cfg *config.KwildConfig)

AddConfigFlags adds all flags from KwildConfig to the given flagSet.

func DefaultEmptyConfig

func DefaultEmptyConfig() *config.KwildConfig

DefaultEmptyConfig returns a config with all fields set to their zero values. This is used by viper to extract all the heirarchical keys from the config structure.

func EmptyConfig

func EmptyConfig() *config.KwildConfig

EmptyConfig returns a config with all fields set to their zero values (except no nil pointers for the sub-sections structs). This is useful for guaranteeing that all fields are set when merging.

func ExpandPath

func ExpandPath(path string) (string, error)

func GetCfg

func GetCfg(flagCfg *config.KwildConfig) (*config.KwildConfig, bool, error)

GetCfg gets the kwild config It has the following precedence (low to high): 1. Default 2. Config file 3. Env vars 4. Command line flags It takes the config generated from the command line flags to override default. It also takes a flag to indicate if the caller wants to modify the defaults for "quickstart" mode. Presently this just makes the HTTP RPC service listen on all interfaces instead of the default of localhost.

func InitPrivateKeyAndGenesis

func InitPrivateKeyAndGenesis(cfg *config.KwildConfig, autogen bool) (privateKey *crypto.Ed25519PrivateKey,
	genConfig *chain.GenesisConfig, err error)

func LoadConfigFile

func LoadConfigFile(configPath string) (*config.KwildConfig, error)

LoadConfig reads a config.toml at the given path and returns a KwilConfig. If the file does not exist, it will return an ErrConfigFileNotFound error.

func LoadEnvConfig

func LoadEnvConfig() (*config.KwildConfig, error)

LoadEnvConfig loads a config from environment variables.

func ReadOrCreatePrivateKeyFile

func ReadOrCreatePrivateKeyFile(keyPath string, autogen bool) (priv, pub []byte, generated bool, err error)

ReadOrCreatePrivateKeyFile will read the node key pair from the given file, or generate it if it does not exist and requested.

func ResetAll

func ResetAll(rootDir string) error

ResetAll removes all data.

Types

This section is empty.

Jump to

Keyboard shortcuts

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