@igormaka/llenv
v0.0.2
Published
Lightweight CLI to apply environment variables from a single JSON config before launching any command
Maintainers
Readme
llenv
Lightweight CLI to apply environment variables from a single JSON config before launching any command. Zero dependencies — just Node.js.
Install
No installation needed! Use with npx:
npx @igormaka/llenv --helpConfig
Create ~/.llenv/config.json:
{
"defaultEnv": "litellm",
"envs": {
"litellm": {
"ANTHROPIC_BASE_URL": "https://litellm.example.com",
"ANTHROPIC_AUTH_TOKEN": "$LITELLM_KEY"
},
"litellm-local": {
"ANTHROPIC_BASE_URL": "http://localhost:4000",
"ANTHROPIC_AUTH_TOKEN": "sk-local-proxy-1234"
},
"ollama": {
"ANTHROPIC_BASE_URL": "http://localhost:11434",
"ANTHROPIC_AUTH_TOKEN": "ollama",
"ANTHROPIC_MODEL": "llama3:latest"
}
}
}envs— object mapping environment names to their variables.defaultEnv(optional) — env to use when--envis omitted. If not set, the first entry inenvsis used.
Variable interpolation
Values can reference existing environment variables using $VAR or ${VAR} syntax. Unset variables expand to an empty string.
{
"envs": {
"dev": {
"DEBUG": "$SHOULD_DEBUG",
"GREETING": "hello ${USER}"
}
}
}SHOULD_DEBUG=1 npx @igormaka/llenv --env dev my-app
# DEBUG=1, GREETING=hello <your username>Usage
# Launch with default env (litellm)
npx @igormaka/llenv claude
# Launch with a named env
npx @igormaka/llenv --env ollama claude
# Works with any command
npx @igormaka/llenv --env litellm-local npm start
# List available environments
npx @igormaka/llenv --list
# Preview env vars without running anything
npx @igormaka/llenv --show ollamaOptions
| Flag | Description |
|------|-------------|
| --env <name> | Use a named env from config |
| --list | List available environments |
| --show [name] | Print resolved vars without executing |
| --help | Show help |
Override config path
Set LLENV_CONFIG to use a different config file:
LLENV_CONFIG=./my-config.json npx @igormaka/llenv --env prod my-appTry it out
Clone the repo to try example configs:
git clone https://github.com/igor-makarov/llenv.git
cd llenv
LLENV_CONFIG=./examples/simple.json npx @igormaka/llenv --list
LLENV_CONFIG=./examples/simple.json npx @igormaka/llenv --show dev
LLENV_CONFIG=./examples/simple.json npx @igormaka/llenv --env prod printenv APP_ENV
# Variable interpolation
SHOULD_DEBUG=1 LLENV_CONFIG=./examples/interpolation.json npx @igormaka/llenv --show dev