config

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 5, 2018 License: MIT Imports: 8 Imported by: 20

Documentation

Index

Constants

View Source
const (
	UnknownNaming mbNaming = iota
	LocalNaming
	FullNaming
)

Mailbox naming strategies.

Variables

View Source
var (
	// Version of this build, set by main
	Version = ""

	// BuildDate for this build, set by main
	BuildDate = ""
)

Functions

func Usage

func Usage()

Usage prints out the envconfig usage to Stderr.

Types

type POP3

type POP3 struct {
	Addr    string        `required:"true" default:"0.0.0.0:1100" desc:"POP3 server IP4 host:port"`
	Domain  string        `required:"true" default:"inbucket" desc:"HELLO domain"`
	Timeout time.Duration `required:"true" default:"600s" desc:"Idle network timeout"`
	Debug   bool          `ignored:"true"`
}

POP3 contains the POP3 server configuration.

type Root

type Root struct {
	LogLevel      string   `required:"true" default:"info" desc:"debug, info, warn, or error"`
	MailboxNaming mbNaming `required:"true" default:"local" desc:"Use local or full addressing"`
	SMTP          SMTP
	POP3          POP3
	Web           Web
	Storage       Storage
}

Root contains global configuration, and structs with for specific sub-systems.

func Process

func Process() (*Root, error)

Process loads and parses configuration from the environment.

type SMTP

type SMTP struct {
	Addr            string        `required:"true" default:"0.0.0.0:2500" desc:"SMTP server IP4 host:port"`
	Domain          string        `required:"true" default:"inbucket" desc:"HELO domain"`
	MaxRecipients   int           `required:"true" default:"200" desc:"Maximum RCPT TO per message"`
	MaxMessageBytes int           `required:"true" default:"10240000" desc:"Maximum message size"`
	DefaultAccept   bool          `required:"true" default:"true" desc:"Accept all mail by default?"`
	AcceptDomains   []string      `desc:"Domains to accept mail for"`
	RejectDomains   []string      `desc:"Domains to reject mail for"`
	DefaultStore    bool          `required:"true" default:"true" desc:"Store all mail by default?"`
	StoreDomains    []string      `desc:"Domains to store mail for"`
	DiscardDomains  []string      `desc:"Domains to discard mail for"`
	Timeout         time.Duration `required:"true" default:"300s" desc:"Idle network timeout"`
	Debug           bool          `ignored:"true"`
}

SMTP contains the SMTP server configuration.

type Storage

type Storage struct {
	Type            string            `required:"true" default:"memory" desc:"Storage impl: file or memory"`
	Params          map[string]string `desc:"Storage impl parameters, see docs."`
	RetentionPeriod time.Duration     `required:"true" default:"24h" desc:"Duration to retain messages"`
	RetentionSleep  time.Duration     `required:"true" default:"50ms" desc:"Duration to sleep between mailboxes"`
	MailboxMsgCap   int               `required:"true" default:"500" desc:"Maximum messages per mailbox"`
}

Storage contains the mail store configuration.

type Web

type Web struct {
	Addr           string `required:"true" default:"0.0.0.0:9000" desc:"Web server IP4 host:port"`
	UIDir          string `required:"true" default:"ui" desc:"User interface dir"`
	GreetingFile   string `required:"true" default:"ui/greeting.html" desc:"Home page greeting HTML"`
	TemplateCache  bool   `required:"true" default:"true" desc:"Cache templates after first use?"`
	MailboxPrompt  string `required:"true" default:"@inbucket" desc:"Prompt next to mailbox input"`
	CookieAuthKey  string `desc:"Session cipher key (text)"`
	MonitorVisible bool   `required:"true" default:"true" desc:"Show monitor tab in UI?"`
	MonitorHistory int    `required:"true" default:"30" desc:"Monitor remembered messages"`
}

Web contains the HTTP server configuration.

Jump to

Keyboard shortcuts

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