Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotenv: add never option to confirmation prompt #9102

Merged
merged 3 commits into from
Jul 11, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Expanded {dis,}allowed syntax and added note about preference
  • Loading branch information
mcornella authored Jul 11, 2020
commit d5161b9f72be5fea07b30ccca7df2c3caa1ad5c4
17 changes: 11 additions & 6 deletions plugins/dotenv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,17 @@ Set `ZSH_DOTENV_PROMPT=false` in your zshrc file if you don't want the confirmat
You can also choose the `Always` option when prompted to always allow sourcing the .env file
in that directory. See the next section for more details.

### ZSH_DOTENV_{DIS,}ALLOWED_LIST
### ZSH_DOTENV_ALLOWED_LIST, ZSH_DOTENV_DISALLOWED_LIST

The default behavior of the plugin is to always ask whether to source a dotenv file. There's
a **Y**es, **N**o, **A**lways and N**e**ver option. If you choose Always, the directory of the .env file
will be added to an allowed list, for Never it get's added to a disallowed list respectively. If a directory is found in those lists, the plugin won't ask
for confirmation and will instead source the .env file or proceed without action directly.
will be added to an allowed list; if you choose Never, it get's added to a disallowed list.
If a directory is found in those lists, the plugin won't ask for confirmation and will instead
either source the .env file or proceed without action respectively.

This (dis-)allowed list is saved by default in `$ZSH_CACHE_DIR/dotenv-{dis,}allowed.list`. If you want
to change that location, change the `$ZSH_DOTENV_{DIS,}ALLOWED_LIST` variable, like so:
This allowed and disallowed lists are saved by default in `$ZSH_CACHE_DIR/dotenv-allowed.list` and
`$ZSH_CACHE_DIR/dotenv-disallowed.list` respectively. If you want to change that location,
change the `$ZSH_DOTENV_ALLOWED_LIST` and `$ZSH_DOTENV_DISALLOWED_LIST` variables, like so:

```zsh
# in ~/.zshrc, before Oh My Zsh is sourced:
Expand All @@ -70,9 +72,12 @@ ZSH_DOTENV_DISALLOWED_LIST=/path/to/dotenv/disallowed/list
```

The file is just a list of directories, separated by a newline character. If you want
to change your decistion, just edit the file and remove the line for the directory you want to
to change your decision, just edit the file and remove the line for the directory you want to
change.

NOTE: if a directory is found in both the allowed and disallowed lists, the disallowed list
takes preference, _i.e._ the .env file will never be sourced.

## Version Control

**It's strongly recommended to add `.env` file to `.gitignore`**, because usually it contains sensitive information such as your credentials, secret keys, passwords etc. You don't want to commit this file, it's supposed to be local only.
Expand Down