View Source env (util v1.3.4)

Environment utils

Link to this section Summary

Functions

Get application configuration

Perform replacement of environment variable values in the OsPath.

Perform replacement of environment variable values in the OsPath. This function also allows to provide a list of Bindings that override the environment (they are checked before environment variables are looked up).

Link to this section Functions

Link to this function

get_env(App, Key, Default)

View Source
-spec get_env(atom(), atom(), any()) -> any().

Get application configuration

Link to this function

replace_env_vars(OsPath)

View Source
-spec replace_env_vars(list() | binary()) -> list() | binary().

Perform replacement of environment variable values in the OsPath.

  Example:
    env:replace_env_vars("~/app")       -> "/home/cuser/app"
    env:replace_env_vars("${HOME}/app") -> "/home/cuser/app"
    env:replace_env_vars("$USER/app")   -> "cuser/app"

See also: os:getenv/1.

Link to this function

replace_env_vars(OsPath, Bindings)

View Source
-spec replace_env_vars(list() | binary(), [{atom() | string(), string()}]) -> list() | binary().

Perform replacement of environment variable values in the OsPath. This function also allows to provide a list of Bindings that override the environment (they are checked before environment variables are looked up).

  Example:
    env:replace_env_vars("~/",   [{"HOME", "/home/cu"}]) -> "/home/cu/"
    env:replace_env_vars("~/",   [{home,   "/home/cu"}]) -> "/home/cu/"
    env:replace_env_vars("$A/",  [{a, "/aaa"}]) -> "/aaa/"
    env:replace_env_vars("${A}/",[{a, "/aaa"}]) -> "/aaa/"

See also: os:getenv/1.

-spec subst_env_path(list() | binary()) -> list() | binary().
Link to this function

subst_env_path(OsPath, Bindings)

View Source
-spec subst_env_path(list() | binary(), [{atom() | string(), string()}]) -> list() | binary().