package
0.1.1
Repository: https://github.com/threefoldtech/zos4.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:

  1. use environment.Get() to get the information if possible.

  2. use environment.MustGet() to get information or panic on error.

To get organization defined configurations:

  1. use environment.GetConfig() to get the organization configurations for the running mode.

  2. 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).

# Type aliases

PubMac specify how the mac address of the public nic (in case of public-config) is calculated.
RunMode type.