home

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

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

Go to latest
Published: Apr 2, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigDirName is the config directory name
	ConfigDirName = ".get3w"
	// RootConfigName is the name of root config file
	RootConfigName = "config.json"
	// Version is the version of cli
	Version = "0.0.1"
)

Variables

This section is empty.

Functions

func DecodeAuth

func DecodeAuth(authStr string) (string, string, string, error)

DecodeAuth decodes a base64 encoded string and returns username and password

func EncodeAuth

func EncodeAuth(authConfig *AuthConfig) string

EncodeAuth creates a base64 encoded string to containing authorization information

func Path

func Path(relatedPath string) string

Path get home path

Types

type AuthConfig

type AuthConfig struct {
	Username    string
	Password    string
	AccessToken string
}

AuthConfig contains authorization information

type Config

type Config struct {
	Auth       string       `json:"auth"`
	Apps       []*get3w.App `json:"apps,omitempty"`
	AuthConfig AuthConfig   `json:"-"`
}

Config ~/.get3w/config.json file info

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig reads the configuration files in the given directory, and sets up the auth config information and return values.

func LoadFromReader

func LoadFromReader(configData io.Reader) (*Config, error)

LoadFromReader is a convenience function that creates a Config object from a reader

func NewConfig

func NewConfig() *Config

NewConfig initilizes an empty configuration file

func (*Config) LoadFromReader

func (config *Config) LoadFromReader(configData io.Reader) error

LoadFromReader reads the configuration data given and sets up the auth config information with given directory and populates the receiver object

func (*Config) Logout

func (config *Config) Logout() error

Logout user authorization

func (*Config) Save

func (config *Config) Save() error

Save encodes and writes out all the authorization information

func (*Config) SaveToWriter

func (config *Config) SaveToWriter(writer io.Writer) error

SaveToWriter encodes and writes out all the authorization information to the given writer

Jump to

Keyboard shortcuts

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