config

package
v0.0.0-...-19e15d3 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName service.Name = "config"

Variables

This section is empty.

Functions

func Dump

func Dump(config *Config, w io.Writer) error

func ServiceProvider

func ServiceProvider(config *Config) service.Provider

func WithEnvironment

func WithEnvironment(conf *Config) error

Types

type Config

type Config struct {
	HTTP  HTTPConfig  `yaml:"http"`
	SMTP  SMTPConfig  `yaml:"smtp"`
	Data  DataConfig  `yaml:"data"`
	Relay RelayConfig `yaml:"relay"`
}

func From

func From(container *service.Container) (*Config, error)

From retrieves the config service in the given container

func Must

func Must(container *service.Container) *Config

Must retrieves the config service in the given container or panic otherwise

func NewDefault

func NewDefault() *Config

func NewDumpDefault

func NewDumpDefault() *Config

func NewFromFile

func NewFromFile(filepath string) (*Config, error)

NewFromFile retrieves the configuration from the given file

type DataConfig

type DataConfig struct {
	Path string `yaml:"path" env:"FAKESMTP_DATA_PATH"`
}

type HTTPConfig

type HTTPConfig struct {
	Address     string `yaml:"address" env:"FAKESMTP_HTTP_ADDRESS"`
	TemplateDir string `yaml:"templateDir" env:"FAKESMTP_HTTP_TEMPLATEDIR"`
	PublicDir   string `yaml:"publicDir" env:"FAKESMTP_HTTP_PUBLICDIR"`
	BaseURL     string `yaml:"baseUrl" env:"FAKESMTP_HTTP_BASEURL"`
}

type RelayConfig

type RelayConfig struct {
	Enabled            bool   `yaml:"enabled" env:"FAKESMTP_RELAY_ENABLED"`
	Address            string `yaml:"address" env:"FAKESMTP_RELAY_ADDRESS"`
	Identity           string `yaml:"identity" env:"FAKESMTP_RELAY_IDENTITY"`
	Username           string `yaml:"username" env:"FAKESMTP_RELAY_USERNAME"`
	Password           string `yaml:"password" env:"FAKESMTP_RELAY_PASSWORD"`
	Anonymous          bool   `yaml:"anonymous" env:"FAKESMTP_RELAY_ANONYMOUS"`
	UseTLS             bool   `yaml:"useTLS" env:"FAKESMTP_RELAY_USE_TLS"`
	InsecureSkipVerify bool   `yaml:"insecureSkipVerify" env:"FAKESMTP_RELAY_INSECURE_SKIP_VERIFY"`
	FromOverride       string `yaml:"fromOverride" env:"FAKESMTP_RELAY_FROM_OVERRIDE"`
}

type SMTPConfig

type SMTPConfig struct {
	Address           string        `yaml:"address" env:"FAKESMTP_SMTP_ADDRESS"`
	Username          string        `yaml:"username" env:"FAKESMTP_SMTP_USERNAME"`
	Password          string        `yaml:"password" env:"FAKESMTP_SMTP_PASSWORD"`
	Domain            string        `yaml:"domain" env:"FAKESMTP_SMTP_DOMAIN"`
	ReadTimeout       time.Duration `yaml:"readTimeout" env:"FAKESMTP_SMTP_READTIMEOUT"`
	WriteTimeout      time.Duration `yaml:"writeTimeout" env:"FAKESMTP_SMTP_WRITETIMEOUT"`
	MaxMessageBytes   int           `yaml:"maxMessageBytes" env:"FAKESMTP_SMTP_MAXMESSAGEBYTES"`
	MaxRecipients     int           `yaml:"maxRecipients" env:"FAKESMTP_SMTP_MAXRECIPIENTS"`
	AllowInsecureAuth bool          `yaml:"allowInsecureAuth" env:"FAKESMTP_SMTP_ALLOWINSECUREAUTH"`
	Debug             bool          `yaml:"debug" env:"FAKESMTP_SMTP_DEBUG"`
}

Jump to

Keyboard shortcuts

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