prefs

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2016 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RcPath

func RcPath() (string, error)

RcPath returns the torusrc filepath

func ValidatePublicKey

func ValidatePublicKey(filePath string) error

ValidatePublicKey checks the publickey path for valid file

Types

type Core

type Core struct {
	PublicKeyFile  string `ini:"public_key_file,omitempty"`
	CABundleFile   string `ini:"ca_bundle_file,omitempty"`
	RegistryURI    string `ini:"registry_uri,omitempty"`
	Context        bool   `ini:"context,omitempty"`
	AutoConfirm    bool   `ini:"auto_confirm,omitempty"`
	EnableProgress bool   `ini:"progress"`
	EnableHints    bool   `ini:"hints"`
	Vim            bool   `ini:"vim,omitempty"`
}

Core contains core option values

type Defaults

type Defaults struct {
	Organization string `ini:"org,omitempty"`
	Project      string `ini:"project,omitempty"`
	Environment  string `ini:"environment,omitempty"`
	Service      string `ini:"service,omitempty"`
}

Defaults contains default values for use in command argument flags

type Preferences

type Preferences struct {
	Core     Core     `ini:"core"`
	Defaults Defaults `ini:"defaults"`
}

Preferences represents the configuration as user has in their torusrc file

func NewPreferences

func NewPreferences() (*Preferences, error)

NewPreferences returns a new instance of preferences struct

func (Preferences) CountFields

func (prefs Preferences) CountFields(fieldName string) int

CountFields returns the number of defined fields on sub-field struct

func (Preferences) SetValue

func (prefs Preferences) SetValue(key string, value string) (Preferences, error)

SetValue for ini key on preferences struct

type PublicKey

type PublicKey struct {
	PublicKey base64.Value `json:"public_key"`
}

PublicKey is en ed25519 public key.

func LoadPublicKey

func LoadPublicKey(prefs *Preferences) (*PublicKey, error)

LoadPublicKey reads the publickey file from disk and parses the json

Jump to

Keyboard shortcuts

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