Created
April 8, 2026 15:40
-
-
Save alirp88/c97b63216dff31fb5c42b33e6e4d8f0e to your computer and use it in GitHub Desktop.
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
| #!/bin/zsh | |
| # To load the secret from keychain in macos | |
| load_secret() { | |
| local name=$1 | |
| local value=$(security find-generic-password -a "$USER" -s "$name" -w 2>/dev/null) | |
| if [ -n "$value" ]; then | |
| export "$name"="$value" | |
| fi | |
| } | |
| load_secret SECRET_NAME | |
| # To save the secret into keychain in macos | |
| security add-generic-password -a "$USER" -s SECRET_NAME -w "SECRET_VALUE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment