config

package
v3.1.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnknownNaming mbNaming = iota
	LocalNaming
	FullNaming
	DomainNaming
)

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 Lua

type Lua struct {
	Path string `required:"false" default:"inbucket.lua" desc:"Lua script path"`
}

Lua contains the Lua extension host configuration.

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"`
	TLSEnabled bool          `default:"false" desc:"Enable TLS"`
	TLSPrivKey string        `default:"cert.key" desc:"X509 Private Key file for TLS Support"`
	TLSCert    string        `default:"cert.crt" desc:"X509 Public Certificate file for TLS Support"`
	ForceTLS   bool          `default:"false" desc:"If true, TLS is always on. If false, enable STLS"`
}

POP3 contains the POP3 server configuration.

type Root

type Root struct {
	LogLevel      string `required:"true" default:"info" desc:"debug, info, warn, or error"`
	Lua           Lua
	MailboxNaming mbNaming `required:"true" default:"local" desc:"Use local, full, or domain 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"`
	RejectOriginDomains []string      `desc:"Domains to reject mail from"`
	Timeout             time.Duration `required:"true" default:"300s" desc:"Idle network timeout"`
	TLSEnabled          bool          `default:"false" desc:"Enable STARTTLS option"`
	TLSPrivKey          string        `default:"cert.key" desc:"X509 Private Key file for TLS Support"`
	TLSCert             string        `default:"cert.crt" desc:"X509 Public Certificate file for TLS Support"`
	Debug               bool          `ignored:"true"`
	ForceTLS            bool          `default:"false" desc:"Listen for connections with TLS."`
}

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"`
	BasePath       string `default:"" desc:"Base path prefix for UI and API URLs"`
	UIDir          string `required:"true" default:"ui/dist" desc:"User interface dir"`
	GreetingFile   string `required:"true" default:"ui/greeting.html" desc:"Home page greeting HTML"`
	MonitorVisible bool   `required:"true" default:"true" desc:"Show monitor tab in UI?"`
	MonitorHistory int    `required:"true" default:"30" desc:"Monitor remembered messages"`
	PProf          bool   `required:"true" default:"false" desc:"Expose profiling tools on /debug/pprof"`
}

Web contains the HTTP server configuration.

Jump to

Keyboard shortcuts

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