config

package
v2.0.0-beta.13 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Name:   "default",
	Host:   "http://localhost:9999",
	Active: true,
}

DefaultConfig is default config without token

Functions

This section is empty.

Types

type Config

type Config struct {
	Name string `toml:"-" json:"-"`
	Host string `toml:"url" json:"url"`
	// Token is base64 encoded sequence.
	Token          string `toml:"token" json:"token"`
	Org            string `toml:"org" json:"org"`
	Active         bool   `toml:"active,omitempty" json:"active,omitempty"`
	PreviousActive bool   `toml:"previous,omitempty" json:"previous,omitempty"`
}

Config store the crendentials of influxdb host and token.

func ParseActiveConfig

func ParseActiveConfig(r io.Reader) (Config, error)

ParseActiveConfig returns the active config from the reader.

type Configs

type Configs map[string]Config

Configs is map of configs indexed by name.

func (Configs) Switch

func (cfgs Configs) Switch(name string) error

Switch to another config.

type ConfigsService

type ConfigsService interface {
	CreateConfig(Config) (Config, error)
	DeleteConfig(name string) (Config, error)
	UpdateConfig(Config) (Config, error)
	SwitchActive(name string) (Config, error)
	ListConfigs() (Configs, error)
}

ConfigsService is the service to list and write configs.

func NewLocalConfigSVC

func NewLocalConfigSVC(Path, Dir string) ConfigsService

NewLocalConfigSVC create a new local config svc.

Jump to

Keyboard shortcuts

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