Documentation
¶
Overview ¶
Package config handles loading and managing msgvault configuration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultHome ¶
func DefaultHome() string
DefaultHome returns the default msgvault home directory. Respects MSGVAULT_HOME environment variable and expands ~ in its value.
func MkTempDir ¶ added in v0.6.0
MkTempDir creates a temporary directory with fallback logic for restricted environments (e.g. Windows where %TEMP% may be inaccessible due to permissions, antivirus, or group policy).
It tries the following locations in order:
- Each directory in preferredDirs (if any)
- The system default temp directory (os.TempDir())
- A "tmp" subdirectory under the msgvault home directory (~/.msgvault/tmp/)
The first successful location is used. If all locations fail, the error from the system temp dir attempt is returned along with the final fallback error.
Types ¶
type Config ¶
type Config struct {
Data DataConfig `toml:"data"`
OAuth OAuthConfig `toml:"oauth"`
Sync SyncConfig `toml:"sync"`
// Computed paths (not from config file)
HomeDir string `toml:"-"`
// contains filtered or unexported fields
}
Config represents the msgvault configuration.
func Load ¶
Load reads the configuration from the specified file. If path is empty, uses the default location (~/.msgvault/config.toml), which is optional (missing file returns defaults). If path is explicitly provided, the file must exist.
homeDir overrides the home directory (equivalent to MSGVAULT_HOME). When set, config.toml is loaded from homeDir unless path is also set.
func NewDefaultConfig ¶ added in v0.4.0
func NewDefaultConfig() *Config
NewDefaultConfig returns a configuration with default values.
func (*Config) AnalyticsDir ¶
AnalyticsDir returns the path to the Parquet analytics directory.
func (*Config) AttachmentsDir ¶
AttachmentsDir returns the path to the attachments directory.
func (*Config) ConfigFilePath ¶ added in v0.5.0
ConfigFilePath returns the path to the config file. If a config was loaded (including via --config), returns the actual path used. Otherwise returns the default location based on HomeDir.
func (*Config) DatabaseDSN ¶ added in v0.4.0
DatabaseDSN returns the database connection string or file path.
func (*Config) EnsureHomeDir ¶ added in v0.5.0
EnsureHomeDir creates the msgvault home directory if it doesn't exist.
type DataConfig ¶
type DataConfig struct {
DataDir string `toml:"data_dir"`
DatabaseURL string `toml:"database_url"`
}
DataConfig holds data storage configuration.
type OAuthConfig ¶
type OAuthConfig struct {
ClientSecrets string `toml:"client_secrets"`
}
OAuthConfig holds OAuth configuration.
type SyncConfig ¶
type SyncConfig struct {
RateLimitQPS int `toml:"rate_limit_qps"`
}
SyncConfig holds sync-related configuration.