@envlines/env-fetcher
v1.0.2
Published
CLI tool to fetch environment files from a remote API and write them locally.
Downloads
4
Readme
Platform Env Fetcher
Important: Before using this CLI, you must create an account at envlines.com and manage your application secrets there. The CLI fetches environment files for your app from the Envlines platform, so you need to have your app and secrets set up in your Envlines account.
A world-class CLI tool to fetch environment files for your app from a remote API and write them locally.
Features
- Fetches all environment files for a given app from a central API
- Writes each file (e.g.,
.env,.env.production) to your current directory - Prompts for API key and app name if not provided
- Supports
.env-fetcher.jsonconfig file and environment variables - Colorful, clear output and error messages
- Prompts before overwriting existing files (unless
--force) - Zero config, plug-and-play
- Helpful
--helpand--versionoutput
Quickstart
Install dependencies:
npm installRun the CLI (no arguments needed):
npx platform-env-fetcherOr, after installing globally:
npm install -g .
platform-env-fetcherOptions
--app, -a(optional): App name to fetch env for. If not provided, you will be prompted or it will use config/env var.--force, -f(optional): Overwrite existing files without prompting.--help, -h: Show help.--version, -v: Show version.
Configuration
You can set defaults in a .env-fetcher.json file in your project root:
{
"appName": "servicepilot"
}Or use environment variables:
ENV_API_KEY: Your API keyENV_APP_NAME: Your app name
How it works
- The tool fetches env files from the API endpoint:
https://mono.specvista.com/platform-eng/api/v1/ci-env/get-env?appName=<your-app-name> - The API should return a JSON object where keys are filenames and values are file contents, e.g.:
{ ".env": "KEY=VALUE\nANOTHER=123", ".env.production": "KEY=PROD_VALUE" } - Each file is written to your current working directory.
- If a file exists, you will be prompted before overwriting (unless
--forceis used).
Advanced Usage
- Use a config file for team-wide defaults.
- Use
--forcein CI/CD to avoid prompts. - Combine with npm scripts for automation.
Troubleshooting
- Ensure your API key is correct and has access to the app.
- Check your network connection if fetch fails.
- Use
--forceif you want to overwrite files without prompts.
Contributing
Pull requests and issues are welcome! See the GitHub repo for details.
License
MIT
