paths

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() (string, error)

ConfigDir returns the directory for cloudstic configuration and state files. Resolution order:

  1. CLOUDSTIC_CONFIG_DIR environment variable (if set)
  2. os.UserConfigDir()/cloudstic (platform default)

The directory is created with 0700 permissions if it does not exist.

func MachineID added in v1.14.0

func MachineID() string

MachineID returns a unique identifier for the current machine. It tries to read from common system files.

func ProfilesPath added in v1.17.0

func ProfilesPath(filename string, create bool) (string, error)

ProfilesPath resolves the path to a profiles file named filename inside the config directory. Resolution follows ConfigDir's CLOUDSTIC_CONFIG_DIR then os.UserConfigDir() precedence; CLOUDSTIC_PROFILES_FILE is deliberately not consulted here, since callers that expose this as a flag default apply it themselves via their own env-bound flag (so a live env value is never baked into what -h displays).

If create is true, the config directory is created as ConfigDir does. If false, no filesystem access occurs — for callers that need a default value before deciding whether the directory should exist (e.g. a dry-run preview that must not create configuration as a side effect of being asked what it would do).

func SaveAtomic added in v1.14.0

func SaveAtomic(path string, data []byte) error

SaveAtomic writes data to a temporary file in the target directory and atomically renames it to path to prevent file corruption during crashes. It ensures 0600 permissions on the final file.

func TokenPath

func TokenPath(filename string) (string, error)

TokenPath returns the full path for a token file stored inside the config directory (e.g. "google_token.json" → "~/.config/cloudstic/google_token.json").

Types

This section is empty.

Jump to

Keyboard shortcuts

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