From 8042ca44d90c87c9d3c0c9ecf5035d33fbd556b6 Mon Sep 17 00:00:00 2001 From: Sam Stern Date: Thu, 4 Dec 2014 10:45:53 -0800 Subject: [PATCH] Set ClientId/Secret to default if either env var is missing --- README.md | 2 +- init.go | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 37df1fcd..b314daa4 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Use `drive help` for further reference. ## Configuration -If you would like to use your own client ID/client secret pair with `drive`, set the `DRIVE_CLIENT_ID` and `DRIVE_CLIENT_SECRET` variables in your environment +If you would like to use your own client ID/client secret pair with `drive`, set the `GOOGLE_API_CLIENT_ID` and `GOOGLE_API_CLIENT_SECRET` variables in your environment ## Why another Google Drive client? Background sync is not just hard, it's stupid. My technical and philosophical rants about why it is not worth to implement: diff --git a/init.go b/init.go index ed4cb5e2..6027bf7a 100644 --- a/init.go +++ b/init.go @@ -21,13 +21,10 @@ import ( func (g *Commands) Init() (err error) { var refresh string - g.context.ClientId = os.Getenv("DRIVE_CLIENT_ID") - if g.context.ClientId == "" { + g.context.ClientId = os.Getenv("GOOGLE_API_CLIENT_ID") + g.context.ClientSecret = os.Getenv("GOOGLE_API_CLIENT_SECRET") + if g.context.ClientId == "" || g.context.ClientSecret == "" { g.context.ClientId = "354790962074-7rrlnuanmamgg1i4feed12dpuq871bvd.apps.googleusercontent.com" - } - - g.context.ClientSecret = os.Getenv("DRIVE_CLIENT_SECRET") - if g.context.ClientSecret == "" { g.context.ClientSecret = "RHjKdah8RrHFwu6fcc0uEVCw" }