config

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2019 License: Apache-2.0, MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Validators = map[string]func(string, string) error{
	"heartbeat.nickname": validateLettersOnly,
}

Validators hold the list of validation functions for each configuration property. Validators must take a key and json string respectively as arguments, and must return either an error or nil depending on whether or not the given key and value are valid. Validators will only be run if a property being set matches the name given in this map.

Functions

This section is empty.

Types

type APIConfig

type APIConfig struct {
	Address                       string   `json:"address"`
	AccessControlAllowOrigin      []string `json:"accessControlAllowOrigin"`
	AccessControlAllowCredentials bool     `json:"accessControlAllowCredentials"`
	AccessControlAllowMethods     []string `json:"accessControlAllowMethods"`
}

APIConfig holds all configuration options related to the api.

type BootstrapConfig

type BootstrapConfig struct {
	Addresses        []string `json:"addresses"`
	MinPeerThreshold int      `json:"minPeerThreshold"`
	Period           string   `json:"period,omitempty"`
}

BootstrapConfig holds all configuration options related to bootstrap nodes

type Config

type Config struct {
	API       *APIConfig         `json:"api"`
	Bootstrap *BootstrapConfig   `json:"bootstrap"`
	Datastore *DatastoreConfig   `json:"datastore"`
	Swarm     *SwarmConfig       `json:"swarm"`
	Mining    *MiningConfig      `json:"mining"`
	Wallet    *WalletConfig      `json:"wallet"`
	Heartbeat *HeartbeatConfig   `json:"heartbeat"`
	Net       string             `json:"net"`
	Metrics   *MetricsConfig     `json:"metrics"`
	Mpool     *MessagePoolConfig `json:"mpool"`
}

Config is an in memory representation of the filecoin configuration file

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig returns a config object with all the fields filled out to their default values

func ReadFile

func ReadFile(file string) (*Config, error)

ReadFile reads a config file from disk.

func (*Config) Get

func (cfg *Config) Get(key string) (interface{}, error)

Get gets the config sub-struct referenced by `key`, e.g. 'api.address'

func (*Config) Set

func (cfg *Config) Set(dottedKey string, jsonString string) error

Set sets the config sub-struct referenced by `key`, e.g. 'api.address' or 'datastore' to the json key value pair encoded in jsonVal.

func (*Config) WriteFile

func (cfg *Config) WriteFile(file string) error

WriteFile writes the config to the given filepath.

type DatastoreConfig

type DatastoreConfig struct {
	Type string `json:"type"`
	Path string `json:"path"`
}

DatastoreConfig holds all the configuration options for the datastore. TODO: use the advanced datastore configuration from ipfs

type HeartbeatConfig

type HeartbeatConfig struct {
	// BeatTarget represents the address the filecoin node will send heartbeats to.
	BeatTarget string `json:"beatTarget"`
	// BeatPeriod represents how frequently heartbeats are sent.
	// Golang duration units are accepted.
	BeatPeriod string `json:"beatPeriod"`
	// ReconnectPeriod represents how long the node waits before attempting to reconnect.
	// Golang duration units are accepted.
	ReconnectPeriod string `json:"reconnectPeriod"`
	// Nickname represents the nickname of the filecoin node,
	Nickname string `json:"nickname"`
}

HeartbeatConfig holds all configuration options related to node heartbeat.

type MessagePoolConfig

type MessagePoolConfig struct {
	// MaxPoolSize is the maximum number of pending messages will will allow in the message pool at any time
	MaxPoolSize int `json:"maxPoolSize"`
	// MaxNonceGap is the maximum nonce of a message past the last received on chain
	MaxNonceGap types.Uint64 `json:"maxNonceGap"`
}

MetricsConfig holds all configuration options related to nodes message pool (mpool).

type MetricsConfig

type MetricsConfig struct {
	// Enabled will enable prometheus metrics when true.
	PrometheusEnabled bool `json:"prometheusEnabled"`
	// ReportInterval represents how frequently filecoin will update its prometheus metrics.
	ReportInterval string `json:"reportInterval"`
	// PrometheusEndpoint represents the address filecoin will expose prometheus metrics at.
	PrometheusEndpoint string `json:"prometheusEndpoint"`
}

MetricsConfig holds all configuration options related to node metrics.

type MiningConfig

type MiningConfig struct {
	MinerAddress            address.Address `json:"minerAddress"`
	AutoSealIntervalSeconds uint            `json:"autoSealIntervalSeconds"`
	StoragePrice            *types.AttoFIL  `json:"storagePrice"`
}

MiningConfig holds all configuration options related to mining.

type SwarmConfig

type SwarmConfig struct {
	Address            string `json:"address"`
	PublicRelayAddress string `json:"public_relay_address,omitempty"`
}

SwarmConfig holds all configuration options related to the swarm.

type WalletConfig

type WalletConfig struct {
	DefaultAddress address.Address `json:"defaultAddress,omitempty"`
}

WalletConfig holds all configuration options related to the wallet.

Jump to

Keyboard shortcuts

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