lib/backend.js
function loadDynamoConfig(env, AWS) {
  const dynamoConfig = {
    endpoint: 'http://localhost:8000',
    sslEnabled: false,
    region: 'us-east-1',
    accessKeyId: 'key',
    secretAccessKey: env.AWS_SECRET_ACCESS_KEY || 'secret'
  }

  loadDynamoEndpoint(env, dynamoConfig)

  if (AWS.config) {
    if (AWS.config.region !== undefined) {
      dynamoConfig.region = AWS.config.region
    }

    if (AWS.config.credentials) {
      if (AWS.config.credentials.accessKeyId !== undefined) {
        dynamoConfig.accessKeyId = AWS.config.credentials.accessKeyId
      }
    }
  }

  if (env.AWS_REGION) {
    dynamoConfig.region = env.AWS_REGION
  }

  if (env.AWS_ACCESS_KEY_ID) {
    dynamoConfig.accessKeyId = env.AWS_ACCESS_KEY_ID
  }

  return dynamoConfig
}
function loadDynamoConfig(env, AWS) {
  const dynamoConfig = {
    endpoint: 'http://localhost:8000',
    sslEnabled: false,
    region: 'us-east-1',
    accessKeyId: 'key',
    secretAccessKey: env.AWS_SECRET_ACCESS_KEY || 'secret'
  }

  loadDynamoEndpoint(env, dynamoConfig)

  if (AWS.config) {
    if (AWS.config.region !== undefined) {
      dynamoConfig.region = AWS.config.region
    }

    if (AWS.config.credentials) {
      if (AWS.config.credentials.accessKeyId !== undefined) {
        dynamoConfig.accessKeyId = AWS.config.credentials.accessKeyId
      }
    }
  }

  if (env.AWS_REGION) {
    dynamoConfig.region = env.AWS_REGION
  }

  if (env.AWS_ACCESS_KEY_ID) {
    dynamoConfig.accessKeyId = env.AWS_ACCESS_KEY_ID
  }

  return dynamoConfig
}
function loadDynamoConfig ( env , AWS ) { const dynamoConfig = { endpoint : 'http://localhost:8000' , sslEnabled : false , region : 'us-east-1' , accessKeyId : 'key' , secretAccessKey : env . AWS_SECRET_ACCESS_KEY || 'secret' } loadDynamoEndpoint ( env , dynamoConfig ) if ( AWS . config ) { if ( AWS . config . region !== undefined ) { dynamoConfig . region = AWS . config . region } if ( AWS . config . credentials ) { if ( AWS . config . credentials . accessKeyId !== undefined ) { dynamoConfig . accessKeyId = AWS . config . credentials . accessKeyId } } } if ( env . AWS_REGION ) { dynamoConfig . region = env . AWS_REGION } if ( env . AWS_ACCESS_KEY_ID ) { dynamoConfig . accessKeyId = env . AWS_ACCESS_KEY_ID } return dynamoConfig }
Create the configuration for the local dynamodb instance.

Region and AccessKeyId are determined as follows:
1) Look at local aws configuration in ~/.aws/credentials
2) Look at env variables env.AWS_REGION and env.AWS_ACCESS_KEY_ID
3) Use default values 'us-east-1' and 'key'

@param env - the process environment
@param AWS - the AWS SDK object
@returns {{endpoint: string, sslEnabled: boolean, region: string, accessKeyId: string}}
Create the configuration for the local dynamodb instance .