config

package
v0.0.0-...-2cabe76 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiConfig

type ApiConfig struct {
	Smtp struct {
		Host string `envconfig:"API_SMTP_HOST" required:"true"`
		Port uint16 `envconfig:"API_SMTP_PORT" default:"465" required:"true"`
		Data struct {
			Limit           uint32 `envconfig:"API_SMTP_DATA_LIMIT" default:"1048576" required:"true"`
			TruncUrlQueries bool   `envconfig:"API_SMTP_DATA_TRUNC_URL_QUERIES" default:"false"`
		}
		Recipients struct {
			Publish  []string `envconfig:"API_SMTP_RECIPIENTS_PUBLISH" required:"true"`
			Internal []string `envconfig:"API_SMTP_RECIPIENTS_INTERNAL" required:"true"`
			Limit    uint16   `envconfig:"API_SMTP_RECIPIENTS_LIMIT" default:"100" required:"true"`
		}
		Timeout struct {
			Read  time.Duration `envconfig:"API_SMTP_TIMEOUT_READ" default:"1m" required:"true"`
			Write time.Duration `envconfig:"API_SMTP_TIMEOUT_WRITE" default:"1m" required:"true"`
		}
		Tls struct {
			CertPath       string             `envconfig:"API_SMTP_TLS_CERT_PATH" default:"/etc/smtp/tls/tls.crt" required:"true"`
			KeyPath        string             `envconfig:"API_SMTP_TLS_KEY_PATH" default:"/etc/smtp/tls/tls.key" required:"true"`
			VersionMin     uint16             `envconfig:"API_SMTP_TLS_VERSION_MIN" default:"769" required:"true"`
			ClientAuthType tls.ClientAuthType `envconfig:"API_SMTP_TLS_CLIENT_AUTH_TYPE" default:"4" required:"true"`
		}
	}
	Group     string `envconfig:"API_GROUP" default:"default" required:"true"`
	EventType EventTypeConfig
	Writer    struct {
		Backoff  time.Duration `envconfig:"API_WRITER_BACKOFF" default:"10s" required:"true"`
		Internal WriterInternalConfig
		Uri      string `envconfig:"API_WRITER_URI" default:"http://pub:8080/v1" required:"true"`
	}
	Token struct {
		Internal string `envconfig:"API_TOKEN_INTERNAL" required:"true"`
	}
}

type Config

type Config struct {
	Api ApiConfig
	Log struct {
		Level int `envconfig:"LOG_LEVEL" default:"-4" required:"true"`
	}
}

func NewConfigFromEnv

func NewConfigFromEnv() (cfg Config, err error)

type EventTypeConfig

type EventTypeConfig struct {
	Self string `envconfig:"API_EVENT_TYPE_SELF" required:"true" default:"com_awakari_email_v1"`
}

type ReaderConfig

type ReaderConfig struct {
	UriEventBase string `envconfig:"API_READER_URI_EVT_BASE" default:"https://awakari.com/pub-msg.html?id=" required:"true"`
}

type WriterCacheConfig

type WriterCacheConfig struct {
	Size uint32        `envconfig:"API_WRITER_CACHE_SIZE" default:"100" required:"true"`
	Ttl  time.Duration `envconfig:"API_WRITER_CACHE_TTL" default:"24h" required:"true"`
}

type WriterInternalConfig

type WriterInternalConfig struct {
	Name  string `envconfig:"API_WRITER_INTERNAL_NAME" default:"awkinternal" required:"true"`
	Value int32  `envconfig:"API_WRITER_INTERNAL_VALUE" required:"true"`
}

Jump to

Keyboard shortcuts

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