config

package
v2.7.5 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

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

DefaultConfig is default config without token

Functions

func DefaultPath

func DefaultPath() (string, error)

DefaultPath computes the path where CLI configs will be stored if not overridden.

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"`
	Cookie         string `toml:"cookie,omitempty" json:"cookie,omitempty"`
}

Config store the crendentials of influxdb host and token.

type Configs

type Configs map[string]Config

Configs is map of configs indexed by name.

type Service

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

Service is the service to list and write configs.

func NewLocalConfigService

func NewLocalConfigService(path string) Service

NewLocalConfigService creates a new service that can write and parse configs to/from a path on local disk.

Jump to

Keyboard shortcuts

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