Documentation
¶
Overview ¶
Package config provides types and functions for node configuration loading and generation.
Index ¶
- Constants
- Variables
- func AddConfigFlags(flagSet *pflag.FlagSet, cfg *config.KwildConfig)
- func DefaultEmptyConfig() *config.KwildConfig
- func EmptyConfig() *config.KwildConfig
- func ExpandPath(path string) (string, error)
- func GetCfg(flagCfg *config.KwildConfig) (*config.KwildConfig, bool, error)
- func InitPrivateKeyAndGenesis(cfg *config.KwildConfig, autogen bool) (privateKey *crypto.Ed25519PrivateKey, genConfig *chain.GenesisConfig, ...)
- func LoadConfigFile(configPath string) (*config.KwildConfig, error)
- func LoadEnvConfig() (*config.KwildConfig, error)
- func ReadOrCreatePrivateKeyFile(keyPath string, autogen bool) (priv, pub []byte, generated bool, err error)
- func ResetAll(rootDir string) error
Constants ¶
const (
DefaultTLSCertFileName = "rpc.cert"
)
Variables ¶
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 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.
Types ¶
This section is empty.