Skip to content

Commit

Permalink
resolving merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
rajitha1998 committed Feb 8, 2020
2 parents b8bac79 + 58b59ff commit 3b875fc
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 12 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Node Cloud Build

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x]

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: yarn install and test
run: |
yarn install
yarn test
env:
CI: true
31 changes: 22 additions & 9 deletions examples/database/aws-dynamodb.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
const nodeCloud = require("../../lib/");
const ncAWS = nodeCloud.getProvider("AWS", process.env.ncconf);
const optionsProvider = {
overrideProviders: false
};
const ncProviders = nodeCloud.getProviders(optionsProvider);
const assert = require("chai").assert;

const options = {
apiVersion: "2016-11-15"
};

// get nosql object for AWS
const dynamoDB = ncAWS.nosql(options);
// Initialize dynamoDB object to access AWS DynamoDB
const dynamoDB = ncProviders.aws.nosql(options);

const params = {
Item: {
artist: {
S: "GG"
id: {
S: "1"
},
racer: {
S: "Carroll Shelby"
}
},
ReturnConsumedCapacity: "TOTAL",
TableName: "Test"
};

dynamoDB.createItem(params).then((res) => {
assert.equal(res.ConsumedCapacity.TableName, "Test");
done();
});
dynamoDB
.createItem(params)
.then((res) => {
assert.equal(res.ConsumedCapacity.TableName, "Test");
console.log("Response :", res);
})
.catch((err) => {
console.log("Error:", err);
});
22 changes: 19 additions & 3 deletions lib/core/base-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,20 @@ class Provider {

let providersToLoad = {};

if (options && options.hasOwnProperty("overrideProviders")) {
if (
options !== null &&
options !== undefined &&
options.overrideProviders === true
) {
ncConfig.map((provider) => {
const module = provider.plugin;
providersToLoad[provider.tag] = module(provider.configPath);
try {
providersToLoad[provider.tag] = module(provider.configPath);
} catch (err) {
throw new Error(
"🤖 It seems you have not added a valid cloud provider"
);
}
});
} else {
ncConfig.map((provider) => {
Expand All @@ -38,7 +48,13 @@ class Provider {
}

const module = provider.plugin;
providersToLoad[provider.tag] = module(provider.configPath);
try {
providersToLoad[provider.tag] = module(provider.configPath);
} catch (err) {
throw new Error(
"🤖 It seems you have not added a valid cloud provider"
);
}
});
}

Expand Down

0 comments on commit 3b875fc

Please sign in to comment.