config

package
v4.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2017 License: GPL-3.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DefaultCounter      = common.DefaultCounter
	DefaultPasswordType = common.DefaultPasswordType
)

Defaults for new MPConfig structs

Variables

This section is empty.

Functions

func Gcfn

func Gcfn(f, home string, abort <-chan struct{}) <-chan string

Gcfn generates standard locations of configFile filepaths

Precedence:

  1. ./gompw.toml
  2. $HOME/.gompw.toml
  3. /etc/gompw.toml

Types

type MPConfig

type MPConfig struct {
	MasterPasswordSeed string `toml:"masterPasswordSeed,omitempty"`
	PasswordPurpose    string `toml:"passwordPurpose,omitempty"`
	PasswordType       string `toml:"passwordType,omitempty"`
	Fullname           string `toml:"fullname,omitempty"`
	Password           string `toml:"password,omitempty"`
	Site               string `toml:"site,omitempty"`
	ConfigFile         string // reordered for struct alignment
	Counter            uint32 `toml:"counter,omitempty"` // Counter >= 1
	// contains filtered or unexported fields
}

MPConfig is the intermediate struct for toml.Unmarshal

userConfig =unmarshal=> MPConfig =merge=> MasterPW

func NewMPConfig

func NewMPConfig() *MPConfig

NewMPConfig returns a new MPConfig with defaults set

func (*MPConfig) Dump

func (c *MPConfig) Dump() error

Dump will dump formatted output of the user configuration file.

func (*MPConfig) LoadConfig

func (c *MPConfig) LoadConfig(configFile string) error

LoadConfig will load and toml.Unmarshal the given configFile

func (*MPConfig) Merge

func (mpc *MPConfig) Merge(c *MPConfig)

Merge will merge c ==> mpc for any nil entries

func (*MPConfig) SetDump

func (c *MPConfig) SetDump(dump bool)

SetDump sets a flag that will trigger LoadConfig() to dump after Unmarshal

Jump to

Keyboard shortcuts

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