Environment Variables

Read ENV from the client's workstation

System.get_env/1 on your server reads the server’s environment. To read a variable from the user’s workstation, ask the context.

@desc "Show the active AWS profile on your machine"
def whoami do
  case env("AWS_PROFILE") do
    nil -> puts("No AWS_PROFILE set")
    profile -> puts("Using #{profile}")
  end
end

In a plain handler the same value is Context.env(ctx, "AWS_PROFILE").

Entitlements

Like the file system, the client’s environment is gated. By default the server can’t read it, and the user grants individual variables with terminalwire-exec policy. Ask for the few you need; don’t expect the whole environment.