How to use the @cloudant/cloudant function in @cloudant/cloudant

To help you get started, we’ve selected a few @cloudant/cloudant examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github IBM / watson-discovery-news-alerting / app / src / bluemix / config.js View on Github external
// use IAM creds
    credentials.use_iam = true
    credentials.iam_apikey = process.env.CLOUDANT_IAM_APIKEY
    credentials.iam_username = process.env.CLOUDANT_IAM_USERNAME
    console.log("credentials.iam_apikey: " + credentials.iam_apikey)
    console.log("credentials.iam_username: " + credentials.iam_username)
  } else {
    credentials.username = process.env.CLOUDANT_USERNAME
    credentials.password = process.env.CLOUDANT_PASSWORD
    console.log("credentials.username: " + credentials.username)
    console.log("credentials.password: " + credentials.password)
  }

  if (credentials.use_iam) {
    // use IAM creds
    var cloudant = new Cloudant({
      account: credentials.iam_username,
      plugins: [
        'promises',
        {
          iamauth: {
            iamApiKey: credentials.iam_apikey
          }
        }
      ],
      plugin: 'promises'  // Using the promises plugin to allow use of async/await
    })
  } else {
    // use traditional uname/pwd
    cloudant = Cloudant({
      account: credentials.username,
      password: credentials.password,
github IBM / watson-discovery-news-alerting / app / src / bluemix / config.js View on Github external
// use IAM creds
    var cloudant = new Cloudant({
      account: credentials.iam_username,
      plugins: [
        'promises',
        {
          iamauth: {
            iamApiKey: credentials.iam_apikey
          }
        }
      ],
      plugin: 'promises'  // Using the promises plugin to allow use of async/await
    })
  } else {
    // use traditional uname/pwd
    cloudant = Cloudant({
      account: credentials.username,
      password: credentials.password,
      plugin: 'promises'  // Using the promises plugin to allow use of async/await
    })
  }

  return cloudant
}

@cloudant/cloudant

Cloudant Node.js client

Apache-2.0
Latest version published 3 years ago

Package Health Score

50 / 100
Full package analysis

Popular @cloudant/cloudant functions