Chapter 4: Linux Advanced Commands
4.10 Environment variables
echo $HOME $USER $PATH $SHELL
env | sort # all environment variables
export APP_ENV=production # set for this session and child processes
echo $APP_ENV
unset APP_ENV
echo 'export PATH=$PATH:$HOME/bin' >> ~/.bashrc # make permanent for your user
source ~/.bashrc # reload without logging out
Keep secrets out of code
Store database passwords in environment variables or a .env file with permission 600, never hard-coded in files that go to GitHub.