config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2019 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// DefaultAlphabet is the default character set used for the separator
	// and padding modifications.
	DefaultAlphabet = []string{
		"!", "@", "$", "%", "^", "&", "*", "-", "_",
		"+", "=", ":", "|", "~", "?", "/", ".", ";",
	}
)

Functions

This section is empty.

Types

type GeneratorConfig

type GeneratorConfig struct {
	NumWords                int      `mapstructure:"num_words"`
	WordLenMin              int      `mapstructure:"word_length_min"`
	WordLenMax              int      `mapstructure:"word_length_max"`
	CaseTransform           string   `mapstructure:"case_transform"`
	SeparatorCharacter      string   `mapstructure:"separator_character"`
	SeparatorAlphabet       []string `mapstructure:"separator_alphabet"`
	PaddingDigitsBefore     int      `mapstructure:"padding_digits_before"`
	PaddingDigitsAfter      int      `mapstructure:"padding_digits_after"`
	PaddingType             string   `mapstructure:"padding_type"`
	PaddingCharacter        string   `mapstructure:"padding_character"`
	SymbolAlphabet          []string `mapstructure:"symbol_alphabet"`
	PadToLength             int      `mapstructure:"pad_to_length"`
	PaddingCharactersBefore int      `mapstructure:"padding_characters_before"`
	PaddingCharactersAfter  int      `mapstructure:"padding_characters_after"`
}

GeneratorConfig represents the configuration for the password generator.

func Load

func Load() (*GeneratorConfig, error)

Load returns a fully loaded configuration for the password generator.

The config will be taken from the defined config file (default or from flag) and can be overridden with flag values.

func (*GeneratorConfig) Validate

func (gc *GeneratorConfig) Validate() error

Validate returns an error if the current configuration is not valid.

Jump to

Keyboard shortcuts

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