Skip to content

Instantly share code, notes, and snippets.

@cmelgarejo
Created July 14, 2019 00:06
Show Gist options
  • Save cmelgarejo/71e88313ba5e84231b53d6ea6975276e to your computer and use it in GitHub Desktop.
Save cmelgarejo/71e88313ba5e84231b53d6ea6975276e to your computer and use it in GitHub Desktop.
#!/bin/sh
srcPath="cmd"
pkgFile="main.go"
app="gql-server"
src="$srcPath/$app/$pkgFile"
printf "\nStart running: $app\n"
# Set all ENV vars for the server to run
export $(grep -v '^#' .env | xargs) && time go run $src
# This should unset all the ENV vars, just in case.
unset $(grep -v '^#' .env | sed -E 's/(.*)=.*/\1/' | xargs)
printf "\nStopped running: $app\n\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment