config

package
v0.0.0-...-900104f Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: LGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMessages = 50
	DefaultTimeout  = 30 // this is in seconds
)

Variables

View Source
var ErrConfigNotFound = errors.New("unable to find configuration")
View Source
var ErrMissingDefaultAccount = errors.New("default_account is missing from config")
View Source
var ErrMissingPassword = errors.New("password has not been set")
View Source
var ErrNotNormalFile = errors.New("not an executable file")
View Source
var ErrPortOutOfRange = errors.New("port out of range")

Functions

func Find

func Find() (string, error)

Find looks for the configuration file in the following order:

  • $PWD/papero.toml
  • ~/.config/papero/papero.toml
  • ~/.papero.toml
  • /etc/papero.toml

returns and error if no file has been found

Types

type AccountData

type AccountData struct {
	Host          string
	Port          int
	Insecure      bool
	Username      string
	Password      *lazy.Lazy
	Proxy         *url.URL
	FolderFilters *Filter
	MailboxPath   string
	Messages      int
	ReadOnly      bool
	Hooks         *Hooks
	Timeout       time.Duration
}

AccountData holds the data for the single account.

func (*AccountData) String

func (a *AccountData) String() string

type CastingErrors

type CastingErrors struct {
	GeneralErrors []error
	AccountErrors map[string]error
}

CastingErrors is a simple wrapper around map[string]error. It's endowed with a utility function to check if there are any errors.

func (CastingErrors) Check

func (c CastingErrors) Check() bool

Check if there are any errors, i.e. if any value of the map is not nil.

func (*CastingErrors) String

func (c *CastingErrors) String() string

type ErrFailedToParseConfig

type ErrFailedToParseConfig struct {
	// contains filtered or unexported fields
}

func (*ErrFailedToParseConfig) Error

func (e *ErrFailedToParseConfig) Error() string

type Filter

type Filter struct {
	// contains filtered or unexported fields
}

func (*Filter) Exec

func (f *Filter) Exec(inputFolders []string) ([]string, error)

func (*Filter) MarshalJSON

func (f *Filter) MarshalJSON() ([]byte, error)

func (*Filter) String

func (f *Filter) String() string

type Hooks

type Hooks struct {
	Pre  exec.Executable
	Each exec.Executable
	Post exec.Executable
}

func (*Hooks) String

func (h *Hooks) String() string

type MemConfig

type MemConfig struct {
	Default  string
	Accounts map[string]*AccountData
}

MemConfig is the data structure that will be used program-wise. It holds all the necessary information to authenticate and manage each provided account.

func Parse

func Parse(filePath string) (*MemConfig, error)

Parse reads the content of the given file and hydrates a *MemConfig.

Jump to

Keyboard shortcuts

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