envcurl
v0.1.0
Published
A thin wrapper around curl with environment variable expansion.
Maintainers
Readme
envcurl
envcurl is a thin wrapper around curl that expands {{VAR}} placeholders in every argument before invoking curl.
envcurl -H "Authorization: Bearer {{API_KEY}}" \
-d '{"token":"{{TOKEN}}","region":"{{REGION:-us-east-1}}"}' \
https://{{API_HOST}}/v1/registerInstallation
Run it directly with npx:
npx envcurl https://{{API_HOST}}/healthOr install it globally after publishing:
npm install -g envcurlVariable syntax
Supported patterns:
{{VAR}}: useVAR; error if it is missing{{VAR:-default}}: useVARif set, otherwise usedefault\{{VAR}}: escape the placeholder and pass the literal{{VAR}}
Variable sources
Variables are resolved in this order, with later sources overriding earlier ones:
- Process environment
.envin the current working directory, if present- Explicit
--env-filevalues, in the order provided, where the last file wins
Examples:
envcurl --env-file .env.production \
-H "Authorization: Bearer {{API_KEY}}" \
https://api.example.com/deployenvcurl --env-file .env --env-file .env.production \
-H "Authorization: Bearer {{API_KEY}}" \
https://api.example.com/deployFlags
| Flag | Description |
|---|---|
| --env-file <path> | Load variables from a specific env file. Repeatable; last file wins for duplicate keys. |
| --expand-stdin | Expand {{VAR}} placeholders in stdin before forwarding to curl. Off by default. |
All other arguments are passed through to curl after variable expansion.
Contributing
Maintainer instructions for testing, packaging, and release flow are in CONTRIBUTING.md.
