{"id":13503029,"url":"https://github.com/mre/envy","last_synced_at":"2025-04-04T18:07:23.882Z","repository":{"id":34291700,"uuid":"174754131","full_name":"mre/envy","owner":"mre","description":"💫 Manage environment variables without cluttering your .zshrc.","archived":false,"fork":false,"pushed_at":"2025-03-13T13:58:10.000Z","size":412,"stargazers_count":76,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T17:08:23.562Z","etag":null,"topics":["cli","direnv","dotenv","environment","variables"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mre.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"mre"}},"created_at":"2019-03-09T22:43:50.000Z","updated_at":"2025-03-13T13:58:14.000Z","dependencies_parsed_at":"2023-11-23T05:40:04.241Z","dependency_job_id":"7f723ba4-2231-4818-b856-38a201986180","html_url":"https://github.com/mre/envy","commit_stats":{"total_commits":184,"total_committers":3,"mean_commits":"61.333333333333336","dds":0.5760869565217391,"last_synced_commit":"170335e80f6a31cd6c6791d5868371aca8bf8eb2"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mre%2Fenvy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mre%2Fenvy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mre%2Fenvy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mre%2Fenvy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mre","download_url":"https://codeload.github.com/mre/envy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247226213,"owners_count":20904465,"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":["cli","direnv","dotenv","environment","variables"],"created_at":"2024-07-31T22:02:34.071Z","updated_at":"2025-04-04T18:07:23.862Z","avatar_url":"https://github.com/mre.png","language":"Rust","funding_links":["https://github.com/sponsors/mre"],"categories":["Shell"],"sub_categories":[],"readme":"# envy\n\nSets environment variables when you enter a directory.\nWorks with bash, zsh, and fish.\n\n[![Documentation](https://docs.rs/envy-cli/badge.svg)](https://docs.rs/envy-cli/)\n![Rust](https://github.com/mre/envy/workflows/Rust/badge.svg)\n\n## Example\n\nAt work, I have to set some environment variables every time I'm working on certain projects.  \nFor example, these can be Google Cloud settings, the Consul host, or Docker configs.\n\nIt's tedious to set the correct environment variables myself every time.\n\n[direnv] automatically loads `.env` files, but I don't want to clutter my system  \nwith `.env` files. Also, I need the same environment variables in a few unrelated  \nprojects, and I don't want to keep the `.env` files in sync.\n\nThus, the idea for `envy` was born.\n\nIt uses a config file that defines what environment variables to set for each folder.\n\n## Installation\n\n```\ncargo install envy-cli\n```\n\nAdd the following line to the end of your `~/.zshrc` file:\n\n```zsh\neval \"$(envy hook zsh)\"\n```\n\nFor bash, use `envy hook bash` instead and add it to your `~/.bashrc` file.\n\n```bash\neval \"$(envy hook bash)\"\n```\n\nFor fish, use `envy hook fish` instead and add it to your\n`~/.config/fish/config.fish` file.\n\n```fish\neval (envy hook fish)\n```\n\nOnce you open a new shell, `envy` will start matching directories and set the\nspecified environment variables from the config file.\n\n## Usage\n\nRun `envy edit` to open the config file. (On macOS, this file is located at\n`/Users/\u003cuser\u003e/Library/Application Support/Envy/Config.toml`.)\n\nDefine the list of regular expressions and the settings.\nThe first regular expression that matches a path wins.\n\n```toml\n[[paths]]\npattern = \".*project1.*\"\nenv = [\n  \"CONSUL_HTTP_ADDR=http://consul:8500\",\n  \"GITHUB_TOKEN=123\"\n]\n\n[[paths]]\npattern = \".*project2.*\"\nenv = [\n  \"DOCKER_HOST=tcp://127.0.0.1:2376\",\n  \"foo=bar\"\n]\n```\n\nThe moment you save the file, the current terminal will automatically pick up\nthe new settings; no need to reload or open a new terminal. :v:\n\n## direnv compatibility\n\n`envy` supports loading environment files à la `direnv` as well. Run `envy allow\n.env` to auto-load the `.env` file in the current path on enter. You can add\nmultiple `.env` files (e.g. `envy allow .envrc`). Duplicate keys will be\noverwritten in the order of appearance in the envy config file (run `envy edit`\nto modify order). Use `envy deny .env` to remove an environment file from the\nlist.\n\n## Command-line options\n\n```\nenvy 0.4.0\ncontext-based environment variables\n\nUSAGE:\n    envy \u003cSUBCOMMAND\u003e\n\nFLAGS:\n    -h, --help       Prints help information\n    -V, --version    Prints version information\n\nSUBCOMMANDS:\n    allow     Grants envy to load the given `.env` file\n    deny      Revokes the authorization of a given `.env` file\n    edit      Edit the envy config file\n    export    Export environment variables based on the current directory\n    find      Find a single environment variable and print its value\n    help      Prints this message or the help of the given subcommand(s)\n    hook      Print the hook to activate envy for your shell\n    load      Load environment variables from a given `.env` file (for the current session only)\n    path      Print path to envy config file\n    show      Show envy config for current directory\n```\n\nNote: To load the environment variables into the current shell, you need to run `eval \"$(envy load)\"`.\n\n## Limitations\n\n- Only tested on macOS. It should also work on Linux and Windows, though.\n- Does not unset variables when you leave a directory.\n- Developing this for myself. Thus, this project won't be worked on very actively.\n\n[direnv]: https://direnv.net/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmre%2Fenvy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmre%2Fenvy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmre%2Fenvy/lists"}