config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = kr.ErrNotFound
)

Functions

func Import added in v0.3.0

func Import(src string, key []byte) (export, error)

Import importable configuration and profile from file.

Types

type Configuration

type Configuration struct {
	ProfileID string `yaml:"profileId"`
	Username  string `yaml:"username"`
	// contains filtered or unexported fields
}

Configuration for the application.

func Configure

func Configure(options ...Option) (Configuration, error)

Configure creates and returns a Configuration. Several options can be provided to modify the behaviour.

func (*Configuration) AddProfile added in v0.3.0

func (c *Configuration) AddProfile(p profile, overwrite bool) error

AddProfile adds a profile to the configuration.

func (Configuration) Export added in v0.3.0

func (c Configuration) Export(dst string, key []byte) error

Export a configuration and profile

func (*Configuration) FromYAML

func (c *Configuration) FromYAML(b []byte) error

FromYAML sets Configuration from yaml.

func (*Configuration) Key

func (c *Configuration) Key() security.Key

Key returns the key.

func (*Configuration) Load

func (c *Configuration) Load() error

Load a Configuration from a yaml file.

func (*Configuration) NewProfile added in v0.3.0

func (c *Configuration) NewProfile(name string, password []byte) (profile, error)

NewProfile creates a new profile and generates a new storage key for it.

func (Configuration) Save

func (c Configuration) Save() error

Save the Configuration to file.

func (*Configuration) SetKey

func (c *Configuration) SetKey(key security.Key) error

SetKey sets the key to the configuration.

func (*Configuration) SetProfile added in v0.3.0

func (c *Configuration) SetProfile(id string) error

SetPorofile sets profile on the configuration.

func (*Configuration) SetStorageKey added in v0.3.0

func (c *Configuration) SetStorageKey(key security.Key) error

SetStorageKey sets the storage key to the configuration.

func (Configuration) StorageKey

func (c Configuration) StorageKey() security.Key

StorageKey returns the key for the storage file.

func (Configuration) StoragePath

func (c Configuration) StoragePath() string

StoragePath returns the storage path of the key file.

func (Configuration) YAML

func (c Configuration) YAML() []byte

YAML returns the YAML encoding of the Configuration.

type Option

type Option func(c *Configuration)

Option sets options to the Configuration.

func WithProfile added in v0.3.0

func WithProfile(id string) Option

WithProfile sets a profile to the Configuration.

func WithUser added in v0.3.0

func WithUser(name string) Option

WithUser sets the user to the Configuration.

Jump to

Keyboard shortcuts

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