Skip to content
This repository has been archived by the owner on Sep 3, 2020. It is now read-only.

Use GOOGLE_API_CLIENT_ID and GOOGLE_API_CLIENT_SECRET #35

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ccmaymay
Copy link

Hi rakyll,

Thanks for writing the drive tool---it's very nice. :) I changed Init() to read GOOGLE_API_CLIENT_ID and GOOGLE_API_CLIENT_SECRET, respectively, from the environment. If either is empty, an error is returned. This is minimalistic, and won't work for everyone, but if you like it feel free to merge. (This is also my first foray into go so it may not be very idiomatic!)

Chandler

@@ -8,6 +8,8 @@

go get github.com/rakyll/drive/cmd/drive

You must set `GOOGLE_API_CLIENT_ID` and `GOOGLE_API_CLIENT_SECRET` appropriately in your environment before running `drive`. For more information, see [the Google API docs](https://developers.google.com/drive/web/quickstart/quickstart-go#step_1_enable_the_drive_api).
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use these values if there are set. If not, fallback to the embedded credentials.


g.context.ClientId = os.Getenv(clientIDEnvKey)
g.context.ClientSecret = os.Getenv(clientSecretEnvKey)
if len(g.context.ClientId) == 0 || len(g.context.ClientSecret) == 0 {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

g.context.ClientID == "" || g.context.C

@rakyll rakyll changed the title Rakyll Use GOOGLE_API_CLIENT_ID and GOOGLE_API_CLIENT_SECRET Dec 4, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants