Documentation
¶
Index ¶
- Constants
- func ConfigDir() (string, error)
- func ConfigPath() (string, error)
- func DeletePassword(email string) error
- func Exists() bool
- func ReleaseIdempotencyKey(key string) error
- func ReserveIdempotencyKey(key string) (bool, error)
- func ScrubSecrets(env []string) []string
- type BridgeConfig
- type Config
- type DefaultsConfig
Constants ¶
const ( AppName = "pm-cli" KeyringUser = "bridge-password" DefaultIMAP = "127.0.0.1" DefaultIMAPPort = 1143 DefaultSMTP = "127.0.0.1" DefaultSMTPPort = 1025 // EnvBridgePassword is the environment variable consulted for the Bridge // password before falling back to the system keyring. This lets pm-cli run // on headless servers that have no D-Bus secret service available, where // keyring.Get fails with "org.freedesktop.secrets was not provided". EnvBridgePassword = "PM_CLI_BRIDGE_PASSWORD" )
Variables ¶
This section is empty.
Functions ¶
func ConfigPath ¶
func DeletePassword ¶
func ReleaseIdempotencyKey ¶ added in v0.2.6
ReleaseIdempotencyKey drops a reservation, so a send that failed can be retried with the same key. It is not an error to release a key that is not held.
func ReserveIdempotencyKey ¶ added in v0.2.6
ReserveIdempotencyKey atomically claims key. It returns true when the caller owns the reservation and should proceed, and false when the key is already held within the TTL, meaning this is a duplicate.
An empty key disables the mechanism and always reserves successfully.
Errors are returned rather than swallowed: if the reservation state cannot be determined, the caller must not treat that as permission to send.
func ScrubSecrets ¶ added in v0.2.6
ScrubSecrets returns env with every pm-cli credential variable removed.
Any code spawning a child process must build its environment from this rather than from os.Environ() directly. Without it, a Bridge password supplied via EnvBridgePassword is inherited by user-supplied commands (for example `mail watch --exec`), handing the mail credential to arbitrary third-party scripts.
The input slice is not modified.
Types ¶
type BridgeConfig ¶
type Config ¶
type Config struct {
Bridge BridgeConfig `yaml:"bridge"`
Defaults DefaultsConfig `yaml:"defaults"`
}
func DefaultConfig ¶
func DefaultConfig() *Config