Skip to content

Instantly share code, notes, and snippets.

@tomsiwik
Created June 30, 2025 21:39
Show Gist options
  • Save tomsiwik/741de995c8d1b4acc6b623446b394b07 to your computer and use it in GitHub Desktop.
Save tomsiwik/741de995c8d1b4acc6b623446b394b07 to your computer and use it in GitHub Desktop.
.env
# Create a vault for your app secrets & api keys
# Mine is Apps
op vault create Apps
# Go into the folder where your .env file is located. Mine is at
# cd project_name/packages/monorepo_pkg/
# I'll use this path for the title too
op item create --category="Login" --vault="Apps" --title="project_name/packages/monorepo_pkg/.env" $(grep -v '^#' .env | grep -v '^$' | sed 's/\([^=]*\)=\(.*\)/\1[password]="\2"/')
# Read them back into .env (on another computer or smth)
op item get "project_name/packages/monorepo_pkg/.env" --vault="Apps" --format=json | jq -r '.fields[] | select(.type=="CONCEALED") | "\(.label)=\(.value)"' > .env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment