Skip to content
This repository has been archived by the owner on Dec 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #84 from IBM/iam-changes
Browse files Browse the repository at this point in the history
Discovery IAM changes
  • Loading branch information
rhagarty authored Jul 31, 2018
2 parents 55fef95 + c260ee3 commit 6e0ca25
Show file tree
Hide file tree
Showing 7 changed files with 528 additions and 616 deletions.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,20 +177,22 @@ Edit the `.env` file with the necessary settings.
#### `env.sample:`

```
# Replace the credentials here with your own.
# Rename this file to .env before starting the app.
# Copy this file to .env and replace the credentials with
# your own before starting the app.
# Watson Discovery
DISCOVERY_USERNAME="XXXXXXXX"
DISCOVERY_PASSWORD="XXXXXXXXX"
DISCOVERY_VERSION="v1"
DISCOVERY_VERSION_DATE="2017-11-07"
DISCOVERY_VERSION_DATE="2018-03-05"
DISCOVERY_ENV_ID="system"
DISCOVERY_URL=<add_discovery_url>
## Un-comment and use either username+password or IAM apikey.
# DISCOVERY_USERNAME=<add_discovery_username>
# DISCOVERY_PASSWORD=<add_discovery_password>
# DISCOVERY_IAM_APIKEY=<add_discovery_iam_apikey>
# Cloudant
CLOUDANT_USERNAME="XXXXXXXXX"
CLOUDANT_PASSWORD="XXXXXXXXXXXXXXX"
CLOUDANT_HOST="XXXXXXXXXXXXXX-bluemix.cloudant.com"
CLOUDANT_USERNAME=<add_cloudant_username>
CLOUDANT_PASSWORD=<add_cloudant_password>
CLOUDANT_HOST=<add_cloudant_host>
DB_NAME="stock-data"
# App Config
Expand Down
7 changes: 3 additions & 4 deletions app/services/discovery.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
*/

const config = require('../../config');
const Discovery = require('watson-developer-cloud/discovery/v1');
const discovery = new Discovery({
version : config.DISCOVERY.version,
version_date : config.DISCOVERY.version_date
const DiscoveryV1 = require('watson-developer-cloud/discovery/v1');
const discovery = new DiscoveryV1({
version: config.DISCOVERY.version_date
});

const NUM_DOCS_TO_QUERY = 5;
Expand Down
7 changes: 3 additions & 4 deletions app/util/cloudantDb.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ const config = require('../../config.js');

var cloudant;

if (config.usingEnv) {
console.log('Initializing cloudant from env');
if (config.usingEnv) {
cloudant = Cloudant({
account : config.CLOUDANT.account,
key : config.CLOUDANT.key,
account : config.CLOUDANT.key,
password : config.CLOUDANT.password
});
console.log('Successfully initialized cloudant');
} else if (config.usingVCAP) {
console.log('Initializing cloudant from VCAP');
console.log('credentials url: ' + config.CLOUDANT.credentialsURL);
Expand Down
3 changes: 1 addition & 2 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ var theConfig = {
db_name : process.env.DB_NAME || 'stock-data'
},
DISCOVERY : {
version : process.env.DISCOVERY_VERSION || 'v1',
version_date : process.env.DISCOVERY_VERSION_DATE || '2017-11-07',
version_date : process.env.DISCOVERY_VERSION_DATE || '2018-03-05',
env_id : process.env.DISCOVERY_ENV_ID || 'system'
}
};
Expand Down
20 changes: 11 additions & 9 deletions env.sample
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
# Replace the credentials here with your own.
# Rename this file to .env before starting the app.
# Copy this file to .env and replace the credentials with
# your own before starting the app.

# Watson Discovery
DISCOVERY_USERNAME="XXXXXXXX"
DISCOVERY_PASSWORD="XXXXXXXXX"
DISCOVERY_VERSION="v1"
DISCOVERY_VERSION_DATE="2017-11-07"
DISCOVERY_VERSION_DATE="2018-03-05"
DISCOVERY_ENV_ID="system"
DISCOVERY_URL=<add_discovery_url>
## Un-comment and use either username+password or IAM apikey.
# DISCOVERY_USERNAME=<add_discovery_username>
# DISCOVERY_PASSWORD=<add_discovery_password>
# DISCOVERY_IAM_APIKEY=<add_discovery_iam_apikey>

# Cloudant
CLOUDANT_USERNAME="XXXXXXXXX"
CLOUDANT_PASSWORD="XXXXXXXXXXXXXXX"
CLOUDANT_HOST="XXXXXXXXXXXXXX-bluemix.cloudant.com"
CLOUDANT_USERNAME=<add_cloudant_username>
CLOUDANT_PASSWORD=<add_cloudant_password>
CLOUDANT_HOST=<add_cloudant_host>
DB_NAME="stock-data"

# App Config
Expand Down
Loading

0 comments on commit 6e0ca25

Please sign in to comment.