993afc8267591707ae48a89de3480e05ff30b3fd

Author
Thomas Witt <thomaswitt@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(dotenv): add named pipe (FIFO) support (#13561)

Diff

 1diff --git a/plugins/dotenv/README.md b/plugins/dotenv/README.md
 2index ab9d329f6f8dc11ac0bd0ebf8d6d1c7602625a1f..5dbcf0fb1446bbd039038cc1390c614bc6015682 100644
 3--- a/plugins/dotenv/README.md
 4+++ b/plugins/dotenv/README.md
 5@@ -78,6 +78,14 @@ change.
 6 NOTE: if a directory is found in both the allowed and disallowed lists, the disallowed list
 7 takes preference, _i.e._ the .env file will never be sourced.
 8 
 9+## Named Pipe (FIFO) Support
10+
11+The plugin supports `.env` files provided as UNIX named pipes (FIFOs) in addition to regular files.
12+This is useful when secrets managers like [1Password Environments](https://developer.1password.com/docs/environment/)
13+mount `.env` files as named pipes to inject secrets on-the-fly without writing them to disk.
14+
15+No additional configuration is required — the plugin automatically detects and sources named pipes.
16+
17 ## Version Control
18 
19 **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.
20diff --git a/plugins/dotenv/dotenv.plugin.zsh b/plugins/dotenv/dotenv.plugin.zsh
21index 46cd4b10ab400f5697c3a101aa52d686812ecab5..c44c369b56d0825de08a2cc6ff430077a59c4f60 100644
22--- a/plugins/dotenv/dotenv.plugin.zsh
23+++ b/plugins/dotenv/dotenv.plugin.zsh
24@@ -11,7 +11,7 @@
25 ## Functions
26 
27 source_env() {
28-  if [[ ! -f "$ZSH_DOTENV_FILE" ]]; then
29+  if [[ ! -f "$ZSH_DOTENV_FILE" ]] && [[ ! -p "$ZSH_DOTENV_FILE" ]]; then
30     return
31   fi
32