LemonCore.Dotenv (lemon_core v0.1.0)

View Source

Minimal .env loader for Lemon runtime processes.

The loader reads <dir>/.env and exports variables into System environment. Existing environment variables are preserved by default.

Summary

Functions

Load <dir>/.env into process environment.

Same as load/2, but logs warnings and always returns :ok.

Resolve the .env path for a directory.

Functions

load(dir \\ nil, opts \\ [])

@spec load(
  String.t() | nil,
  keyword()
) :: :ok | {:error, term()}

Load <dir>/.env into process environment.

If dir is nil or empty, the current process directory is used. Returns :ok when the file is absent or loaded successfully.

load_and_log(dir \\ nil, opts \\ [])

@spec load_and_log(
  String.t() | nil,
  keyword()
) :: :ok

Same as load/2, but logs warnings and always returns :ok.

path_for(dir)

@spec path_for(String.t() | nil) :: String.t()

Resolve the .env path for a directory.