Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigDir ¶
ConfigDir returns the directory for cloudstic configuration and state files. Resolution order:
- CLOUDSTIC_CONFIG_DIR environment variable (if set)
- 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
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
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.
Types ¶
This section is empty.