config

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config resolves where maild keeps its files (docs/design/overview.md#configuration).

Index

Constants

View Source
const AppID = "org.frostyard.Frostmail"

AppID is the reverse-DNS application ID (frostyard/core ADR-0016).

Variables

This section is empty.

Functions

func AppConfigFile added in v0.2.0

func AppConfigFile(getenv func(string) string) (string, error)

AppConfigFile is the app's own configuration, app.json: $XDG_CONFIG_HOME/frostmail/app.json, under HOME/.config without it. In the Flatpak that is ~/.var/app/org.frostyard.Frostmail/config/frostmail.

func DefaultSocket

func DefaultSocket(getenv func(string) string) (string, error)

DefaultSocket is maild's socket when FROSTMAIL_SOCKET is not set: $XDG_RUNTIME_DIR/frostmail/maild.sock. In the Flatpak (InFlatpak) it is $XDG_RUNTIME_DIR/app/org.frostyard.Frostmail/frostmail/maild.sock: Flatpak shares $XDG_RUNTIME_DIR/app/<id> between every sandbox of the app, and the rest of $XDG_RUNTIME_DIR is private to each sandbox, so the window, maild and mailctl meet only there (docs/adr/0046-the-desktop-flatpak-carries-its-own-maild.md).

func InFlatpak added in v0.2.0

func InFlatpak(getenv func(string) string) bool

InFlatpak reports whether the process runs in this application's Flatpak (FLATPAK_ID is AppID). Another application's Flatpak, such as an editor that runs mailctl, is not.

Types

type Mode added in v0.2.0

type Mode string

Mode says which maild a desktop uses: the local one, or the one behind lodge (docs/design/desktop.md, On a maild behind lodge).

const (
	ModeLocal Mode = "local"
	ModeLodge Mode = "lodge"
)

The two modes.

func AppMode added in v0.2.0

func AppMode(getenv func(string) string) (Mode, error)

AppMode is ReadMode of the app.json that AppConfigFile names.

func ReadMode added in v0.2.0

func ReadMode(path string) (Mode, error)

ReadMode reads the mode from the app's app.json at path: lodge when it has a non-empty "lodge" string, else local. A missing file is local; unknown keys are ignored; a file that is not valid JSON, or whose "lodge" is not a string, is an error that names the file. The app writes this file (the Server pane); maild only reads it.

type Paths

type Paths struct {
	DataDir  string // database and blob store; must be on a local filesystem
	CacheDir string // decoded message parts served to the UI
	Socket   string // the RPC socket (a named pipe on Windows)
	DB       string // DataDir/frostmail.db
	Blobs    string // DataDir/blobs
}

Paths are maild's file locations.

func Resolve

func Resolve(getenv func(string) string) (Paths, error)

Resolve computes Paths from the environment: the XDG base directories on Linux, the user's local app data and a per-user named pipe on Windows (ADR-0038). FROSTMAIL_DATA_DIR, FROSTMAIL_CACHE_DIR and FROSTMAIL_SOCKET override the defaults, for tests and for running a second maild.

Jump to

Keyboard shortcuts

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