Skip to content

Instantly share code, notes, and snippets.

@myobie
Created June 4, 2024 08:08
Show Gist options
  • Save myobie/503762eb086ae5b4a490e1448e6c584b to your computer and use it in GitHub Desktop.
Save myobie/503762eb086ae5b4a490e1448e6c584b to your computer and use it in GitHub Desktop.
Using 1password to inject ENV vars into the current shell from .env.* files
#!/bin/bash
# Usage: eval "$(bin/dot-env)"
set -eo pipefail
PROJECT=$(git rev-parse --show-toplevel)
for f in ${PROJECT}/.env.*; do
echo "# ${f}"
op inject -i "$f"
echo "#"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment