config

package
v1.0.54 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Entries map[string]*Entry `yaml:"configs"`
	Current string            `yaml:"current"`
	// contains filtered or unexported fields
}

Config is a set of sd-local config entities

func New

func New(configPath string) (Config, error)

New returns parsed config

func (*Config) AddEntry added in v1.0.0

func (c *Config) AddEntry(name string, entry *Entry) error

AddEntry create new Entry and add it to Config

func (*Config) DeleteEntry added in v1.0.0

func (c *Config) DeleteEntry(name string) error

DeleteEntry deletes Entry object named `name`

func (*Config) Entry added in v1.0.0

func (c *Config) Entry(name string) (*Entry, error)

Entry returns an Entry object named `name`

func (*Config) Save added in v1.0.0

func (c *Config) Save() error

Save write Config to config file

func (*Config) SetCurrent added in v1.0.0

func (c *Config) SetCurrent(name string) error

SetCurrent set a specified entry as current config

type Entry added in v1.0.0

type Entry struct {
	APIURL   string   `yaml:"api-url" mapstructure:"api-url"`
	StoreURL string   `yaml:"store-url" mapstructure:"store-url"`
	Token    string   `yaml:"token" mapstructure:"token"`
	UUID     string   `yaml:"UUID" mapstructure:"uuid"`
	Launcher Launcher `yaml:"launcher" mapstructure:",squash"`
}

Entry is entity struct of sd-local config

func DefaultEntry added in v1.0.28

func DefaultEntry() *Entry

DefaultEntry describes the initial value of an entry

func (*Entry) Set added in v1.0.0

func (e *Entry) Set(key, value string) error

Set preserve sd-local config with new value.

type Launcher

type Launcher struct {
	Version string `yaml:"version" mapstructure:"launcher-version"`
	Image   string `yaml:"image" mapstructure:"launcher-image"`
}

Launcher is launcher entity struct

Jump to

Keyboard shortcuts

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