config

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: MIT Imports: 14 Imported by: 8

README

config Package

Fairly self explanatory.

Documentation

Overview

Package config enables loading and utilizing configuration options for different blockchain networks

Index

Constants

View Source
const (
	LocalConfig ConfigurationType = "local"

	DefaultGeth     string = "geth"
	PerformanceGeth string = "geth_performance"
	RealisticGeth   string = "geth_realistic"
)

Configs

Variables

View Source
var ProjectConfigDirectory string

Functions

func ChainlinkVals

func ChainlinkVals() map[string]interface{}

ChainlinkVals formats Chainlink values set in the framework config to be passed to Chainlink deployments

func GethNetworks

func GethNetworks() []environment.SimulatedNetwork

GethNetworks builds the proper geth network settings to use based on the selected_networks config

func LoadFromEnv added in v1.1.23

func LoadFromEnv() error

LoadFromEnv loads all config files and environment variables

func LoadRemoteEnv added in v1.2.3

func LoadRemoteEnv() error

LoadRemoteEnv loads environment variables when running on remote test runner

Types

type ChainlinkChart

type ChainlinkChart struct {
	Values *ChainlinkValuesWrapper `json:"values,omitempty"`
}

ChainlinkChart holds the overall geth chart values

type ChainlinkImage

type ChainlinkImage struct {
	Image   string `json:"image,omitempty" yaml:"chainlink_image"`
	Version string `json:"version,omitempty" yaml:"chainlink_version"`
}

ChainlinkImage defines chainlink image and version

type ChainlinkValues

type ChainlinkValues struct {
	Image *ChainlinkImage `json:"image,omitempty"`
}

ChainlinkValues wraps all values

type ChainlinkValuesWrapper

type ChainlinkValuesWrapper struct {
	ChainlinkVals        *ChainlinkValues  `json:"chainlink,omitempty"`
	EnvironmentVariables map[string]string `json:"env,omitempty" yaml:"chainlink_env_values"`
}

ChainlinkValuesWrapper Chainlink values wrapper

type ChartOverrides

type ChartOverrides struct {
	GethChartOverride       *GethChart      `json:"geth,omitempty"`
	ChainlinkChartOverrride *ChainlinkChart `json:"chainlink,omitempty"`
}

ChartOverrides enables building json styled chart overrides for the deployed chart values and environment variables

type Config added in v1.1.23

type Config struct {
	FrameworkConfig    *FrameworkConfig    `envconfig:"FRAMEWORK_CONFIG_FILE" default:"../framework.yaml"`
	NetworksConfig     *NetworksConfig     `envconfig:"NETWORKS_CONFIG_FILE" default:"../networks.yaml"`
	RemoteRunnerConfig *RemoteRunnerConfig `envconfig:"REMOTE_RUNNER_CONFIG_FILE" required:"false" default:"../remote_runner_config.yaml"`
	EnvironmentConfig  *environment.Config `envconfig:"ENVIRONMENT_CONFIG_FILE"`
}

Config general framework config

var ProjectConfig Config

type ConfigurationType

type ConfigurationType string

ConfigurationType refers to the different ways that configurations can be set

type ETHNetwork

type ETHNetwork struct {
	ContractsDeployed         bool          `envconfig:"contracts_deployed" yaml:"contracts_deployed"`
	Name                      string        `envconfig:"name" yaml:"name"`
	ChainID                   int64         `envconfig:"chain_id" yaml:"chain_id"`
	URL                       string        `envconfig:"url" yaml:"url"`
	URLs                      []string      `envconfig:"urls" yaml:"urls"`
	Type                      string        `envconfig:"type" yaml:"type"`
	PrivateKeys               []string      `envconfig:"private_keys" yaml:"private_keys"`
	ChainlinkTransactionLimit uint64        `envconfig:"chainlink_transaction_limit" yaml:"chainlink_transaction_limit"`
	Timeout                   time.Duration `envconfig:"transaction_timeout" yaml:"transaction_timeout"`
	MinimumConfirmations      int           `envconfig:"minimum_confirmations" yaml:"minimum_confirmations"`
	GasEstimationBuffer       uint64        `envconfig:"gas_estimation_buffer" yaml:"gas_estimation_buffer"`
	BlockGasLimit             uint64        `envconfig:"block_gas_limit" yaml:"block_gas_limit"`
}

ETHNetwork data to configure fully ETH compatible network

type FrameworkConfig

type FrameworkConfig struct {
	KeepEnvironments string         `envconfig:"KEEP_ENVIRONMENTS" yaml:"keep_environments"`
	Logging          *LoggingConfig `envconfig:"LOGGING" yaml:"logging"`
	ChainlinkImage   string         `yaml:"chainlink_image" envconfig:"CHAINLINK_IMAGE"`
	ChainlinkVersion string         `yaml:"chainlink_version" envconfig:"CHAINLINK_VERSION"`
	// ChainlinkEnvValues uses interface{} as the value because it's needed for proper helmchart merges
	ChainlinkEnvValues map[string]interface{} `envconfig:"CHAINLINK_ENV_VALUES" yaml:"chainlink_env_values"`
}

FrameworkConfig common framework config

func (*FrameworkConfig) Decode added in v1.1.23

func (m *FrameworkConfig) Decode(path string) error

type GethChart

type GethChart struct {
	Values *GethValuesWrapper `json:"values,omitempty"`
}

GethChart holds the overall geth chart values

type GethImage

type GethImage struct {
	Image   string `json:"image,omitempty" yaml:"geth_image"`
	Version string `json:"version,omitempty" yaml:"geth_version"`
}

GethImage defines geth image and version

type GethValues

type GethValues struct {
	Image *GethImage `json:"image,omitempty"`
}

GethValues wraps all values

type GethValuesWrapper

type GethValuesWrapper struct {
	GethVals *GethValues   `json:"geth,omitempty"`
	Args     []interface{} `json:"args,omitempty"`
}

GethValuesWrapper geth values wrapper

type LocalStore

type LocalStore struct {
	RawKeys []string
}

LocalStore retrieves keys defined in a networks.yaml file, or from environment variables

func (*LocalStore) Fetch

func (l *LocalStore) Fetch() ([]string, error)

Fetch private keys from local environment variables or a config file

type LoggingConfig

type LoggingConfig struct {
	WritePodLogs string `envconfig:"WRITE_POD_LOGS" yaml:"write_pod_logs"`
	Level        int8   `envconfig:"LEVEL" yaml:"level"`
}

LoggingConfig for logging

type NetworkSettings

type NetworkSettings map[string]map[string]interface{}

NetworkSettings is a map that holds configuration for each individual network

func (NetworkSettings) Decode

func (n NetworkSettings) Decode(value string) error

Decode is used by envconfig to initialize the custom Charts type with populated values This function will take a JSON object representing charts, and unmarshal it into the existing object to "merge" the two

type NetworksConfig

type NetworksConfig struct {
	SelectedNetworks   []string        `envconfig:"SELECTED_NETWORKS" yaml:"selected_networks"`
	NetworkSettings    NetworkSettings `envconfig:"NETWORKS" yaml:"networks"`
	DefaultKeyStore    string
	ConfigFileLocation string
}

NetworksConfig is network configurations

func (*NetworksConfig) Decode added in v1.1.23

func (m *NetworksConfig) Decode(path string) error

type PrivateKeyStore

type PrivateKeyStore interface {
	Fetch() ([]string, error)
}

PrivateKeyStore enables access, through a variety of methods, to private keys for use in blockchain networks

type RemoteRunnerConfig

type RemoteRunnerConfig struct {
	TestRegex     string   `envconfig:"TEST_REGEX" yaml:"test_regex"`
	TestDirectory string   `envconfig:"TEST_DIRECTORY" yaml:"test_directory"`
	SlackAPIKey   string   `envconfig:"SLACK_API_KEY" yaml:"slack_api_key"`
	SlackChannel  string   `envconfig:"SLACK_CHANNEL" yaml:"slack_channel"`
	SlackUserID   string   `envconfig:"SLACK_USER_ID" yaml:"slack_user_id"`
	CustomEnvVars []string `envconfig:"CUSTOM_ENV_VARS" yaml:"custom_env_vars"`
}

RemoteRunnerConfig reads the config file for remote test runs

func (*RemoteRunnerConfig) Decode added in v1.1.23

func (m *RemoteRunnerConfig) Decode(path string) error

type TerraNetwork

type TerraNetwork struct {
	Name                      string        `envconfig:"name" yaml:"name"`
	ChainName                 string        `envconfig:"chain_name" yaml:"chain_name"`
	Mnemonics                 []string      `envconfig:"mnemonic" yaml:"mnemonic"`
	Currency                  string        `envconfig:"currency" yaml:"currency"`
	Type                      string        `envconfig:"type" yaml:"type"`
	ChainlinkTransactionLimit uint64        `envconfig:"chainlink_transaction_limit" yaml:"chainlink_transaction_limit"`
	Timeout                   time.Duration `envconfig:"transaction_timeout" yaml:"transaction_timeout"`
	MinimumConfirmations      int           `envconfig:"minimum_confirmations" yaml:"minimum_confirmations"`
}

TerraNetwork data to configure Terra network

Jump to

Keyboard shortcuts

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