prefs

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2018 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingHome = errors.New("Could not establish users home directory, is $HOME set?")

ErrMissingHome represents an error where the $HOME dir could not be found

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"`
	ManifestURI        string `ini:"manifest_uri,omitempty"`
	GatekeeperAddress  string `ini:"gatekeeper_address"`
	Context            bool   `ini:"context"`
	AutoConfirm        bool   `ini:"auto_confirm"`
	EnableProgress     bool   `ini:"progress"`
	EnableHints        bool   `ini:"hints"`
	Vim                bool   `ini:"vim"`
	EnableCheckUpdates bool   `ini:"check_updates"`
	EnableColors       bool   `ini:"colors"`
}

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