Skip to content

Commit

Permalink
Added config for explicit credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Wilkerson committed Mar 14, 2018
1 parent 114c8e0 commit 5686eb1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const adapter = {

const {
identity,
projectId
projectId,
keyFilename
} = dsConfig;

if (!projectId) {
Expand All @@ -32,7 +33,7 @@ const adapter = {
// Create a manager
registeredDsEntries[identity] = {
config: dsConfig,
manager: createManager({projectId}),
manager: createManager({projectId, keyFilename}),
sequences: {}
};

Expand Down Expand Up @@ -373,17 +374,20 @@ function buildQueries(ds, s3q) {
/**
* @param {Object} config
* @param {String} config.projectId
* @param {String} config.keyFilename - explicit credentials path (see README.md)
*
* @returns {GoogleCloudDatastore}
*/
function createManager(config) {

const {
projectId
projectId,
keyFilename
} = config;

return new GoogleCloudDatastore({
projectId: projectId,
projectId,
keyFilename
});

}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sails-google-cloud-datastore",
"version": "1.0.1",
"version": "1.0.2",
"description": "Google Cloud Datastore adapter for Sails.js/Waterline.",
"main": "./lib/",
"scripts": {
Expand Down

0 comments on commit 5686eb1

Please sign in to comment.