{"id":13998603,"url":"https://github.com/henrycunh/ev","last_synced_at":"2025-07-24T06:39:21.844Z","repository":{"id":40478775,"uuid":"453834831","full_name":"henrycunh/ev","owner":"henrycunh","description":"✨ A tool for versioning, securing and easily sharing environment variables","archived":false,"fork":false,"pushed_at":"2022-05-05T20:35:50.000Z","size":219,"stargazers_count":62,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-04T16:13:57.208Z","etag":null,"topics":["encryption","environment","environment-variables","sharing","tool"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/henrycunh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-31T00:05:02.000Z","updated_at":"2024-11-13T16:05:31.000Z","dependencies_parsed_at":"2022-08-09T21:40:40.166Z","dependency_job_id":null,"html_url":"https://github.com/henrycunh/ev","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henrycunh%2Fev","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henrycunh%2Fev/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henrycunh%2Fev/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henrycunh%2Fev/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/henrycunh","download_url":"https://codeload.github.com/henrycunh/ev/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248281415,"owners_count":21077423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["encryption","environment","environment-variables","sharing","tool"],"created_at":"2024-08-09T19:01:50.088Z","updated_at":"2025-04-10T19:31:58.712Z","avatar_url":"https://github.com/henrycunh.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# ev\n  \u003csup\u003ea tool for versioning, securing and easily sharing environment variables\u003c/sup\u003e\n\n\u003c/div\u003e\n\n\n\u003cp align=\"center\"\u003e\n  \u003ctable\u003e\n    \u003ctbody\u003e\n      \u003ctd align=\"center\"\u003e\n        \u003cimg width=\"2000\" height=\"0\"\u003e\u003cbr\u003e\n        \u003ca href=\"#initializing\"\u003einitializing\u003c/a\u003e • \u003ca href=\"#commands\"\u003ecommands\u003c/a\u003e • \u003ca href=\"#using-in-your-project\"\u003eusing in your project\u003c/a\u003e\u003cbr\u003e\n        \u003cimg width=\"2000\" height=\"0\"\u003e\n      \u003c/td\u003e\n    \u003c/tbody\u003e\n  \u003c/table\u003e\n\u003c/p\u003e\n\n## Features\n- ⏱ **Version control** - allows for storing environment variables securely in git\n- 🔑 **Secure** - uses a single secret to secure your variables\n- 🧑‍💻 **Easy sharing** - sharing the secret means sharing your variables\n- 🛠 **Great DX** - tools for easily managing variables  \n\n## Getting started\n\n### Initializing\n\nInstall [**Node \u003e= 14**](https://nodejs.org/en/) and run:\n```\nnpx ev\n```\nIt will prompt you for a new **secret key** and create two new files:\n  - `.ev/vars` - where your environment variables are encrypted and safely stored,\n  - `.ev/secret` - your secret key, whose must not be version controlled\n\nAnd add `.ev/secret` to `.gitignore`\n\nYou can install `ev` globally \u003csup\u003e*(so you wont have to prepend `npx`)*\u003c/sup\u003e by running,\n```bash\nnpm install -g @henrycunh/ev\n```\n\n## Commands\n\n\u003cdetails open\u003e\n\u003csummary\u003e\u003cstrong\u003eAdding new variables →\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\n\n```bash\nev MY_KEY=VALUE OTHER_KEY=OTHER_VALUE\n```\n\u003csup\u003eThis will add the `MY_KEY` and `OTHER_KEY` variables, if the variables already exists, their value will be overrided\u003c/sup\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eExporting variables into the environment →\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\n  \n```bash\nev | source\n# you can alternatively use\neval $(ev)\n```\n\u003csup\u003eThis will export every variable into the environment\u003c/sup\u003e\n\nYou can test it by running\n\n```bash\nev TEST=123 \u0026\u0026 ev | source \u0026\u0026 echo $TEST\n```\n\u003csup\u003eThis should print `Added 1 variables.` followed by `123`.\u003c/sup\u003e\n\u003c/details\u003e\n  \n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eRemoving variables →\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\n  \n```bash\nev rm MY_KEY OTHER_KEY\n```\n\u003csup\u003eThis will remove the `MY_KEY` and `OTHER_KEY` variables\u003c/sup\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eListing variables →\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\n  \n```bash\nev ls\n```\n\u003csup\u003eThis will list all variables\u003c/sup\u003e\n```bash\nev ls MY_KEY\n```\n\u003csup\u003eThis will list the `MY_KEY` variable\u003c/sup\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eChanging the secret key →\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\n  \n```bash\nev change-secret\n```\n\u003csup\u003eThis will prompt for the old key and the new one, if the old key is correct, it will re-encrypt the variables with the new one\u003c/sup\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eSetting the secret key →\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\n  \nIn case you mistype your secret, you can just run this to type the secret again\n```bash\nev set-secret\n```\n\u003csup\u003eThis will prompt for the secret\u003c/sup\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eUsing different environments →\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\n  \nYou can append the option `--env` \u003csup\u003e*(or `-e`)*\u003c/sup\u003e on any command to specify a different environment\n```bash\nev -e staging MY_KEY=VALUE_IN_STAGING\n```\n\u003csup\u003eThe variables for each environment is stored in a different file\u003c/sup\u003e\n\u003c/details\u003e\n  \n\u003cdetails\u003e\n  \u003csummary\u003e\u003cstrong\u003eLoading variables from a \u003ccode\u003e.env\u003c/code\u003e file →\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\n  \n```bash\nev load .env\n```\n\u003csup\u003eAll the variables on `.env` will be loaded into the default environment\u003c/sup\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003cstrong\u003eSetting a different secret for specific environments →\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\nWhen using this tool, you may want to give access to staging/local environment variables but not to the production ones.\n\n```bash\nev change-secret -e production\n```\n\u003csup\u003eChanges the default secret on the \u003ccode\u003eproduction\u003c/code\u003e environment\u003c/sup\u003e\n\u003c/details\u003e\n\n## Using in your project\nAfter initializing and setting a secret, you can just load from your previous `.env` file with the command `ev load .env` and run either `ev | source` or `eval $(ev)` to export the variables into the environment.\n\n### Passing a secret through a environment variable\nIn a CI environment, you want your secret to be passed through an environment variable set by your CI system. You can do this by setting the `EV_SECRET` variable\n```bash\nEV_SECRET=my-secret eval $(npx ev)\n```\n\n### Javascript projects\nYou can add a `pre` script to your `package.json` file to load the variables into the environment before your development script runs. Here's an example:\n```json\n{\n  \"scripts\": {\n    \"predev\": \"eval $(ev)\",\n    \"dev\": \"...\"\n  }\n}\n```\nYou can even create different scripts for different environments\n```json\n{\n  \"scripts\": {\n    \"predev:staging\": \"eval $(ev -e staging)\",\n    \"dev:staging\": \"...\"\n  }\n}\n```\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhenrycunh%2Fev","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhenrycunh%2Fev","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhenrycunh%2Fev/lists"}