Skip to content

Instantly share code, notes, and snippets.

@from-unknown
Created May 28, 2020 06:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save from-unknown/fe9fa2b44c27d03302c1a7925fe4624e to your computer and use it in GitHub Desktop.
Save from-unknown/fe9fa2b44c27d03302c1a7925fe4624e to your computer and use it in GitHub Desktop.
Switch .env file for different environment build
#!/usr/bin/env bash
env=$1
if ! [ $# -eq 1 ]; then
echo "Please specify ENV"
echo Usage:
echo "$(basename $0)" ENV
echo ex:
echo "$(basename $0)" develop
echo ""
exit 1
fi
if ! [[ -f ".env.production.${env}" ]]; then
echo file: .env.production."${env}" does not exit
exit 1
fi
cp .env.production."$env" .env.production.local
@from-unknown
Copy link
Author

Switch .env.production.local file for different build environments. e.x. develop, staging, production...
Just copy .env.production.${env} to .env.production.local.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment