entrypoint

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Entrypoint

func Entrypoint(args LaunchArgs) int

Entrypoint implements the actual functionality of the program so it can be called inline from testing. env is normally passed the environment variable array.

func SendEmail

func SendEmail(ctx context.Context, options EmailOptions) error

SendEmail implements the eactual email sending.

Types

type EmailOptions

type EmailOptions struct {
	Username                string        `help:"Username to authenticate to the SMTP server with"`
	Password                string        `help:"Password to authenticate to the SMTP server with"`
	Host                    string        `help:"Hostname"`
	Port                    uint16        `help:"Port number" default:"25"`
	TLSHost                 string        `help:"Hostname to use for verifying TLS (default to host if blank)" default:""`
	Attachments             []string      `help:"Files to attach to the email" type:"existingfile"`
	Subject                 string        `help:"Subject line of the email"`
	Body                    string        `help:"Body of email. Read from stdin if blank."`
	From                    string        `help:"From address for the email."`
	To                      []string      `help:"Email recipients." arg:""`
	Timeout                 time.Duration `help:"Timeout for mail sending."`
	PoolSize                uint          `name:"concurrent-sends" help:"Maximum concurrent send jobs." default:"1"`
	TLSInsecureSkipVerify   bool          `name:"insecure-skip-verify" help:"Disable TLS certificate authentication" default:"false"`
	TLSCertificateAuthority string        `name:"cacert" help:"Specify a custom CA certificate to verify against."`
	HelloHostname           string        `name:"hello-hostname" help:"Hostname to use for SMTP HELO request" default:"localhost"`
}

type LaunchArgs

type LaunchArgs struct {
	StdIn  io.Reader
	StdOut io.Writer
	StdErr io.Writer
	Env    map[string]string
	Args   []string
}

type Options

type Options struct {
	Logging struct {
		Level  string `help:"logging level" default:"warn"`
		Format string `help:"logging format (${enum})" enum:"console,json" default:"console"`
	} `embed:"" prefix:"logging."`

	Version bool `help:"Print the version and exit"`

	Email EmailOptions `embed:""`
}

Jump to

Keyboard shortcuts

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