Util.Env (fnord v0.9.29)

View Source

Utilities for interpreting environment variables used in fnord.

Provide canonical parsing helpers so different runtime contexts treat environment values consistently (escript, mix run, CI, etc.).

Summary

Functions

Delete the environment variable.

Return true when the provided environment value is considered truthy.

Set the environment variable to the given value.

Functions

cursor_rules_debug_enabled?()

@spec cursor_rules_debug_enabled?() :: boolean()

delete_env(var)

@spec delete_env(binary()) :: :ok

Delete the environment variable.

fetch_env(var)

@spec fetch_env(binary()) :: {:ok, binary()} | {:error, :not_set}

get_env(var, default \\ nil)

@spec get_env(binary(), any()) :: any()

looks_truthy?(env_var_name)

@spec looks_truthy?(binary()) :: boolean()

Return true when the provided environment value is considered truthy.

Recognizes the common truthy values (case-insensitive): "1", "true", and "yes". Returns false for nil, empty strings, and other values.

mcp_debug_enabled?()

@spec mcp_debug_enabled?() :: boolean()

put_env(var, value)

@spec put_env(binary(), binary()) :: :ok

Set the environment variable to the given value.