Add APP_ENV var

This commit is contained in:
Corey Johnson 2019-11-22 13:48:06 -08:00
parent 49d5ada937
commit d69f58cd6b
2 changed files with 10 additions and 0 deletions

View file

@ -22,6 +22,7 @@ jobs:
version: latest
args: release
env:
APP_ENV: production
GH_OAUTH_CLIENT_ID: 178c6fc778ccc68e1d6a
GH_OAUTH_CLIENT_SECRET: ${{secrets.OAUTH_CLIENT_SECRET}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

View file

@ -20,13 +20,22 @@ type releaseInfo struct {
}
func CheckForUpdate(handleUpdate chan func()) {
// Only check for updates in production
if os.Getenv("APP_ENV") != "production" {
handleUpdate <- nil
return
}
// Ignore if this stdout is not a tty
if !terminal.IsTerminal(int(os.Stdout.Fd())) {
handleUpdate <- nil
return
}
latestRelease, err := getLatestRelease()
if err != nil {
handleUpdate <- nil
return
}
updateAvailable := latestRelease.Version != command.Version