Documentation
¶
Overview ¶
Package osx extends the standard os package: typed environment lookups with defaults (the config-from-env boilerplate every service re-writes) and an atomic WriteFile.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnvBool ¶
EnvBool returns the environment variable key parsed with strconv.ParseBool ("1", "t", "true", ... case-insensitively), or def when the variable is unset, empty, or unparsable.
func EnvDuration ¶
EnvDuration returns the environment variable key parsed as a time.Duration, or def when the variable is unset, empty, or unparsable. A bare integer (no unit) is read as SECONDS — env files and Helm charts routinely write "30" where Go wants "30s".
func EnvInt ¶
EnvInt returns the environment variable key parsed as an int, or def when the variable is unset, empty, or unparsable.
func EnvInt64 ¶
EnvInt64 returns the environment variable key parsed as an int64, or def when the variable is unset, empty, or unparsable.
func EnvStr ¶
EnvStr returns the value of the environment variable key, or def when the variable is unset or empty.
func WriteFileAtomic ¶
WriteFileAtomic writes data to path via a same-directory temp file and rename, so readers never observe a truncated or half-written file — the guarantee os.WriteFile does not give when the writer crashes mid-write. The temp file lives next to path (rename must not cross filesystems). No fsync: this guards against partial writes, not power loss; callers needing power-loss durability should sync the file and directory themselves.
Types ¶
This section is empty.