configuration

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

README

Insolar – Configuration

tbd

Documentation

Overview

Package configuration holds configuration for all components in Insolar host binary It allows also helps to manage config resources using Holder

Usage:

package main

import (
	"github.com/insolar/insolar/configuration"
	"fmt"
)

func main() {
	holder := configuration.NewHolder()
	fmt.Printf("Default configuration:\n %+v\n", holder.Configuration)
	holder.SaveAs("insolar.yml")
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToString

func ToString(in interface{}) string

ToString converts any configuration struct to yaml string

Types

type BuiltIn

type BuiltIn struct {
}

type Configuration

type Configuration struct {
	Host        HostNetwork
	Node        NodeNetwork
	Service     ServiceNetwork
	Ledger      Ledger
	Log         Log
	Stats       Stats
	LogicRunner LogicRunner
}

Configuration contains configuration params for all Insolar components

func NewConfiguration

func NewConfiguration() Configuration

NewConfiguration creates new default configuration

type Goplugin

type Goplugin struct {
	RunnerListen   string // ip:port of ginsider connectivity socket
	RunnerCodePath string // path where ginsider caches code
	MainListen     string // ip:port of main system connectivity socket
	MainCodePath   string // path of main system code cache
}

type Holder

type Holder struct {
	Configuration Configuration
	// contains filtered or unexported fields
}

Holder provides methods to manage configuration

func NewHolder

func NewHolder() Holder

NewHolder creates new Holder with default configuration

func (*Holder) Load

func (c *Holder) Load() error

Load method reads configuration from default file path

func (*Holder) LoadFromFile

func (c *Holder) LoadFromFile(path string) error

LoadFromFile method reads configuration from particular file path

func (*Holder) Save

func (c *Holder) Save() error

Save method writes configuration to default file path

func (*Holder) SaveAs

func (c *Holder) SaveAs(path string) error

SaveAs method writes configuration to particular file path

type HostNetwork

type HostNetwork struct {
	Transport      Transport
	BootstrapHosts []string
	IsRelay        bool // set if node must be relay explicit
}

HostNetwork holds configuration for HostNetwork

func NewHostNetwork

func NewHostNetwork() HostNetwork

NewHostNetwork creates new default HostNetwork configuration

type Ledger

type Ledger struct {
	DataDirectory string
}

type Log

type Log struct {
	Format string
	Level  string
	Output string
}

Log holds configuration for logging

func NewLog

func NewLog() Log

NewLog creates new default configuration for logging

type LogicRunner

type LogicRunner struct {
	BuiltIn  BuiltIn
	GoPlugin Goplugin
}

func NewLogicRunner

func NewLogicRunner() LogicRunner

type Node

type Node struct {
	NodeID      string
	HostID      string
	ReferenceID string
}

Node holds configuration for one Node

type NodeNetwork

type NodeNetwork struct {
	Nodes []*Node
}

NodeNetwork holds configuration for NodeNetwork

func NewNodeNetwork

func NewNodeNetwork() NodeNetwork

NewNodeNetwork creates new default NodeNetwork configuration

type Service

type Service struct {
}

Service is configuration struct for servicenetwork.Service.

type ServiceNetwork

type ServiceNetwork struct {
	Service Service
}

ServiceNetwork is configuration for ServiceNetwork.

func NewServiceNetwork

func NewServiceNetwork() ServiceNetwork

NewServiceNetwork creates a new ServiceNetwork configuration.

type Stats

type Stats struct {
	ListenAddress string
}

Stats holds configuration for stats publishing

func NewStats

func NewStats() Stats

NewStats creates new default configuration for stats publishing

type Transport

type Transport struct {
	// protocol type UTP or KCP
	Protocol string
	// Address to listen
	Address string
	// if true transport will use network traversal technique(like STUN) to get PublicAddress
	BehindNAT bool
}

Transport holds transport protocol configuration for HostNetwork

Jump to

Keyboard shortcuts

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