config

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: May 24, 2020 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Overview

Package config holds the functionality for configuration.

Index

Constants

View Source
const (
	// YAMLFileType is the file type YAML.
	YAMLFileType = "yaml"
	// EnvPrefix is the environment variable prefix.
	EnvPrefix = "PM"
	// ErrMsgUnableToReadConf is an error message.
	ErrMsgUnableToReadConf = "unable to load configuration file %s"
	// FilePathEnv is env that represents the main configuration path.
	FilePathEnv = "CONF_PATH"
	// FlagCSVFile is the CSV file flag.
	FlagCSVFile = "csv-file"
	// FlagHTMLFile is the HTML file flag.
	FlagHTMLFile = "html-file"
	// DefaultFilePermission represents the password db file default permission.
	DefaultFilePermission = "0640"
	// DefaultFileStorageEnabled default value for whether the File storage is enabled.
	DefaultFileStorageEnabled = true
	// DefaultGoogleDriveStorageEnabled default value for whether the Google drive storage is enabled.
	DefaultGoogleDriveStorageEnabled = !DefaultFileStorageEnabled
	// DefaultPasswordDBFile default value for password database file name.
	DefaultPasswordDBFile = "password-db"
	// DefaultSelectListSize default value for select list size.
	DefaultSelectListSize = 5
	// DefaultDirectoryName default value for password-manager directory name.
	DefaultDirectoryName = "password-manager"
	// DefaultTokenFileName default value for GDrive token file name.
	DefaultTokenFileName = "g_drive_tokenFile"
)

Variables

This section is empty.

Functions

func Init added in v0.5.0

func Init()

Init function configures the viper.

Types

type Config

type Config struct {
	EncryptorID    string  `mapstructure:"encryptorID"`
	SelectListSize int     `mapstructure:"selectListSize"`
	DirectoryPath  string  `mapstructure:"directoryPath"`
	Storage        Storage `mapstructure:"storage"`
}

Config struct represent the configuration for the tool.

type File added in v0.8.0

type File struct {
	Enable         bool   `mapstructure:"enable"`
	PasswordDBFile string `mapstructure:"passwordDBFile"`
	Permission     string `mapstructure:"permission"`
}

File represent file storage configurations.

type GoogleDrive added in v0.9.0

type GoogleDrive struct {
	Enable         bool   `mapstructure:"enable"`
	Directory      string `mapstructure:"directory"`
	PasswordDBFile string `mapstructure:"passwordDBFile"`
}

GoogleDrive represent Google Drive storage configurations.

type Storage added in v0.8.0

type Storage struct {
	File        File        `mapstructure:"file"`
	GoogleDrive GoogleDrive `mapstructure:"googleDrive"`
}

Storage represent storage configurations.

type TransformedConfig added in v0.8.0

type TransformedConfig struct {
	StorageID      string
	EncryptorID    string
	SelectListSize int
	DirectoryPath  string
	Storage        map[string]string
}

TransformedConfig is constructed from Config. This configuration is formed to support different kind of components that is been used.

func Configuration

func Configuration() (*TransformedConfig, error)

Configuration method loads the configuration.

Jump to

Keyboard shortcuts

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