config

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSample

func GenerateSample(path string) error

GenerateSample creates a sample configuration file

Types

type Config

type Config struct {
	IMAP     IMAPConfig     `json:"imap"`
	Database DatabaseConfig `json:"database"`
	Server   ServerConfig   `json:"server"`
}

Config holds the application configuration

func Load

func Load(path string) (*Config, error)

Load loads configuration from a JSON file

type DatabaseConfig

type DatabaseConfig struct {
	Path string `json:"path" env:"DATABASE_PATH"`
}

DatabaseConfig holds database configuration

type IMAPConfig

type IMAPConfig struct {
	Host     string `json:"host" env:"IMAP_HOST"`
	Port     int    `json:"port" env:"IMAP_PORT" envDefault:"993"`
	Username string `json:"username" env:"IMAP_USERNAME"`
	Password string `json:"password" env:"IMAP_PASSWORD"`
	Mailbox  string `json:"mailbox" env:"IMAP_MAILBOX" envDefault:"INBOX"`
	UseTLS   bool   `json:"use_tls" env:"IMAP_USE_TLS" envDefault:"true"`
}

IMAPConfig holds IMAP server configuration

type ServerConfig

type ServerConfig struct {
	Port int    `json:"port" env:"SERVER_PORT" envDefault:"8080"`
	Host string `json:"host" env:"SERVER_HOST" envDefault:"0.0.0.0"`
}

ServerConfig holds web server configuration

Jump to

Keyboard shortcuts

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