config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2019 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckLogin

func CheckLogin(nodeName string, username string, password string) *odm.InfoResponse

CheckLogin checks if the node needs login if it does, it attempts to login it it doesn't, returns node.Info() on error, it prints a message and exits

func Initialize

func Initialize()

Initialize the configuration

Types

type Configuration

type Configuration struct {
	Nodes map[string]odm.Node `json:"nodes"`
	// contains filtered or unexported fields
}

Configuration is a collection of config values

var User Configuration

User contains the user's configuration

func NewConfiguration

func NewConfiguration(filePath string) Configuration

NewConfiguration creates a new configuration from a specified file path

func (Configuration) AddNode

func (c Configuration) AddNode(name string, nodeURL string) error

AddNode adds a new node to the configuration

func (Configuration) GetNode

func (c Configuration) GetNode(name string) (*odm.Node, error)

GetNode gets a Node instance given its name

func (Configuration) RemoveNode

func (c Configuration) RemoveNode(name string) bool

RemoveNode removes a node from the configuration

func (Configuration) Save

func (c Configuration) Save()

Save saves the configuration to file

func (Configuration) UpdateNode

func (c Configuration) UpdateNode(name string, node odm.Node)

type PublicNode

type PublicNode struct {
	Url        string `json:"url"`
	Maintainer string `json:"maintainer"`
	Company    string `json:"company"`
	Website    string `json:"website"`
}

func GetPublicNodes

func GetPublicNodes() []PublicNode

func (PublicNode) String

func (n PublicNode) String() string

Jump to

Keyboard shortcuts

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