config

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLI added in v0.11.0

type CLI struct {
	Command       string   `kong:"-"`
	DataDirectory string   `name:"data-directory" help:"Path to store data." type:"path" optional:""`
	Version       struct{} `cmd:"" hidden:""` // HACK: hidden because kong will throw error if a command is not supplied
}

func ReadAndParseCLI added in v0.11.0

func ReadAndParseCLI() CLI

type Config

type Config struct {
	DatabasePath         string
	AttachmentsDirectory string
	HTTPAddress          string
	HTTPBodyLimit        int
	SMTPAddress          string
	SMTPMaxMessageBytes  int
	Endpoints            []endpoints.Endpoint
	Rules                []rules.Rule
	RuleEndpoints        map[string][]string
	RetentionPolicy      models.RetentionPolicy
}

func Parse added in v0.11.0

func Parse(raw Raw) (Config, error)

type Raw added in v0.11.0

type Raw struct {
	MaxPayloadSize string `name:"max_payload_size" default:"25 MB"`
	DataDirectory  string `name:"data_directory" default:"smtpbridge_data" arg:""`
	Retention      struct {
		EnvelopeCount  int    `name:"envelope_count"`
		EnvelopeAge    string `name:"envelope_age"`
		AttachmentSize string `name:"attachment_size"`
	} `embed:"" prefix:"retention-"`
	HTTP struct {
		Disable bool
		Host    string
		Port    int `default:"8080"`
	} `embed:"" prefix:"http-"`
	SMTP struct {
		Disable bool
		Host    string
		Port    int `default:"1025"`
	} `embed:"" prefix:"smtp-"`
	Endpoints map[string]RawEndpoint
	Rules     map[string]RawRule
}

func Read added in v0.11.0

func Read(cli CLI) (Raw, error)

type RawEndpoint added in v0.11.0

type RawEndpoint struct {
	Name               string
	Kind               string
	Text_Disable       bool
	Body_Template      string
	Attachment_Disable bool
	Config             map[string]string
}

type RawRule added in v0.11.0

type RawRule struct {
	Name       string
	Expression string
	Endpoints  []string
}

Jump to

Keyboard shortcuts

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