import "github.com/egdaemon/eg/runtime/wasi/egenv"
func Boolean(fallback bool, keys ...string) bool
Extract a boolean formatted environment variable from the given keys returns the first valid result if none of the keys exist then the fallback is returned.
func CacheDirectory(paths ...string) string
returns the absolute path to the cache directory, when arguments are provided they are joined joined with the cache directory.
files stored in the cache directory are maintained between runs on a best effort basis. files prefixed with .eg are reserved for system use.
e.g.) CacheDirectory("foo", "bar") -> "/cache/foo/bar"
func EphemeralDirectory(paths ...string) string
returns the absolute path to the ephemeral directory, when arguments are provided they are joined joined with the ephemeral directory.
files stored in the ephemeral directory are maintained for the duration of a single module's execution. and is unique to that module.
e.g.) RuntimeDirectory("foo", "bar") -> "/ephemeral/foo/bar"
func RootDirectory(paths ...string) string
returns the absolute path to the working directory of the module. this directory is the initial working directory of the workload and is used for cloning git repositories etc.
func RunID() string
Read the run ID from the environment
func RuntimeDirectory(paths ...string) string
returns the absolute path to the runtime directory, when arguments are provided they are joined joined with the runime directory.
files stored in the runtime directory are maintained for the duration of a workload. every module will be able to read the data stored in the runtime folder.
e.g.) RuntimeDirectory("foo", "bar") -> "/runtime/foo/bar"
func TTL() time.Duration
Provides the TTL specified by the runtime. used for setting context durations. defaults to an hour. currently not fully implemented.