Last active
March 27, 2026 06:50
-
-
Save davidlee/90a577666971045a4cf0035366347edc to your computer and use it in GitHub Desktop.
1password .env socket -> vercel pubish script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env zsh | |
| # reads .env socket (1password environment secrets) | |
| # and sets them as Vercel sensitive environment vars. | |
| # takes the environment name as argument: | |
| # | |
| # ./sync-env.zsh production | |
| # ./sync-env.zsh staging | |
| # ./sync-env.zsh development | |
| set -euo pipefail | |
| target_env=${1:-production} | |
| typeset -A seen | |
| env_blob=$(<.env) | |
| for line in ${(f)env_blob}; do | |
| [[ -z $line || $line = \#* ]] && continue | |
| key=${line%%=*} | |
| value=${line#*=} | |
| [[ -n ${seen[$key]:-} ]] && continue | |
| seen[$key]=1 | |
| printf %s "$value" | | |
| pnpx vercel env add "$key" "$target_env" --sensitive --force | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment