config

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config provides configuration management for imapsync.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Workers int                `json:"-"   yaml:"-"`   // Number of parallel workers (from CLI)
	Src     Credentials        `json:"src" yaml:"src"` // Source IMAP credentials
	Dst     Credentials        `json:"dst" yaml:"dst"` // Destination IMAP credentials
	Map     []DirectoryMapping `json:"map" yaml:"map"` // Folder mapping rules
}

Config holds the entire configuration for the application.

func New

func New(c *cli.Command) (*Config, error)

New loads configuration from the file specified in CLI context. It automatically detects the format (JSON or YAML) based on file extension. Supported extensions: .json, .yaml, .yml It returns an error if the file cannot be read or contains invalid data.

type Credentials

type Credentials struct {
	Label  string `json:"label"  yaml:"label"`  // Human-readable label for the server
	Server string `json:"server" yaml:"server"` // Server address (host:port)
	User   string `json:"user"   yaml:"user"`   // Username
	Pass   string `json:"pass"   yaml:"pass"`   // Password
}

Credentials holds IMAP connection data.

type DirectoryMapping

type DirectoryMapping struct {
	Source      string `json:"src" yaml:"src"` // Source folder name
	Destination string `json:"dst" yaml:"dst"` // Destination folder name
}

DirectoryMapping holds source and destination folder names.

Jump to

Keyboard shortcuts

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