Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented reading keyFile/credentials field from config object #315

Merged
merged 6 commits into from
Oct 31, 2016

Conversation

kjin
Copy link
Contributor

@kjin kjin commented Oct 27, 2016

Clients may use config.keyFilename and config.credentialsto supply a key file or its contents in lieu of GCLOUD_APPLICATION_CREDENTIALS.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 27, 2016
@kjin
Copy link
Contributor Author

kjin commented Oct 27, 2016

@GoogleCloudPlatform/node-team PTAL

@@ -84,7 +84,9 @@ If your application is running outside of Google Cloud Platform, such as locally
2. Copy the key somewhere your application can access it. Be sure not to expose the key publicly.
3. Set the environment variable `GOOGLE_APPLICATION_CREDENTIALS` to the full path to the key. The debug agent will automatically look for this environment variable.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.


// An alias for keyFile. If both keyFile and keyFilename are set, the value
// of keyFilename will be ignored.
keyFilename: null,

This comment was marked as spam.

This comment was marked as spam.


process.env.GCLOUD_PROJECT = 0;

describe('test-config-credentials', function() {

This comment was marked as spam.

This comment was marked as spam.

this.request_ = utils.authorizedRequestFactory(SCOPES);
this.request_ = utils.authorizedRequestFactory(SCOPES, {
credentials: config.credentials,
keyFile: config.keyFile || config.keyFilename

This comment was marked as spam.

This comment was marked as spam.

3. Alternatively, if you are running your application on a development machine or test environment where you are using the [`gcloud` command line tools][gcloud-sdk], and are logged using `gcloud beta auth application-default login`, you already have sufficient credentials, and a service account key is not required.
If you are running your application on a development machine or test environment where you are using the [`gcloud` command line tools][gcloud-sdk], and are logged using `gcloud beta auth application-default login`, you already have sufficient credentials, and a service account key is not required.

Alternatively, you may set the `keyFilename` or `credentials` configuration field to the full path or contents to the key file, respectively. Setting either of these fields will override both of the above options. (See the [default configuration](config.js) for more details.)

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@@ -84,7 +84,9 @@ If your application is running outside of Google Cloud Platform, such as locally
2. Copy the key somewhere your application can access it. Be sure not to expose the key publicly.
3. Set the environment variable `GOOGLE_APPLICATION_CREDENTIALS` to the full path to the key. The debug agent will automatically look for this environment variable.

This comment was marked as spam.

@kjin
Copy link
Contributor Author

kjin commented Oct 31, 2016

Appveyor failure seems to be due to an unrelated issue (gRPC 1.0.1 compilation on Windows).

// The contents of a key file. If this field is set, its contents will be
// used for authentication instead of your application default credentials.
// If keyFilename is also set, the value of credentials will be ignored.
credentials: null

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants