package
3.12.12+incompatible
Repository: https://github.com/threefoldtech/zos.git
Documentation: pkg.go.dev
# README
Environment module
This module is used to get information about the running environment of a node.
It is also used to get the organization default configurations defined here according to the running mode.
Usage
To get information about the running environment of the node you can use one of the following:
-
use
environment.Get()
to get the information if possible. -
use
environment.MustGet()
to get information or panic on error.
To get organization defined configurations:
-
use
environment.GetConfig()
to get the organization configurations for the running mode. -
use
environment.GetConfigForMode(mode)
to get configurations for a specific mode.
Usage Example
env, err := environment.Get()
if err != nil {
log.Fatal().Err(err).Msg("could not get information about running environment")
}
config, err := environment.GetConfigForMode(env.RunningMode)
if err != nil {
log.Fatal().Err(err).Msgf("could not get configurations of mode %s", env.RunningMode)
}
# Functions
Get return the running environment of the node.
GetConfig returns extend config for current run mode.
GetConfig returns extend config for specific run mode.
GetSubstrate gets a client to subsrate blockchain.
MustGet returns the running environment of the node panics on error.
# Constants
Orphanage is the default farmid where nodes are registered if no farmid were specified on the kernel command line.
Possible running mode of a node.
Possible running mode of a node.
PubMacRandom means the mac of the public nic will be chosen by the system the value won't change across reboots, but is based on the node id (default).
PubMacSwap means the value of the mac is swapped with the physical nic where the public traffic is eventually going through.
RunningDev mode.
RunningMain mode.
RunningQA mode.
RunningTest mode.
# Structs
Config is configuration set by the organization.
Environment holds information about running environment of a node it defines the different constant based on the running mode (dev, test, prod).