config

package
v0.0.0-...-550656a Latest Latest
Warning

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

Go to latest
Published: May 29, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Deals with loading and saving credentials and tokens to the config file.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoUsername = errors.New("no username stored in config")
	ErrNoURL      = errors.New("no URL stored in config")
)

Functions

func ToFile

func ToFile(conf *Config, filename string) error

ToFile saves the given config to the file with the given name.

Types

type Config

type Config struct {
	Username    string
	LoginURL    string
	EndpointURL string
	Token       string
}

Config represents the config file. This object will be serialized to the config file.

func FromFile

func FromFile(filename string) (*Config, error)

FromFile loads the config from the file with the given name.

func (*Config) LoadCredentials

func (c *Config) LoadCredentials() (*hive.Credentials, error)

LoadCredentils constructs the hive.Credentials object using the data from the given Config combined with the password stored in the (platform dependent) keyring.

func (*Config) SaveCredentials

func (c *Config) SaveCredentials(creds *hive.Credentials) error

SaveCredentials saves the data from the given hive.Credentials object to the specified config while also storing the password in the (platform dependent) keyring.

Jump to

Keyboard shortcuts

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