Skip to content

Instantly share code, notes, and snippets.

@xiaoyunyang
Last active July 18, 2023 20:25
Show Gist options
  • Save xiaoyunyang/59f8cc59b55ed0532e1acb30dbe707d7 to your computer and use it in GitHub Desktop.
Save xiaoyunyang/59f8cc59b55ed0532e1acb30dbe707d7 to your computer and use it in GitHub Desktop.
How to keep dev secrets

Instead of always running source .env before running yarn, you can add your dev secrets like NPM_TOKEN or OPEN_AI_API_KEY to a global dev environmental variable file on your machine (e.g. dev.env) then add this to your .bashrc to source it on startup:

# dev.env
export NPM_TOKEN=<create one in npm settings>
# bashrc
source ~/dev.env

Remember to source .bashrc in .bash_profile:

# bash_profile
if [ -f ~/.bashrc ]; then
  source ~/.bashrc
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment