Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

vistahigherlearning / dynamodb-local   deb

Repository URL to install this package:

Version: 1.11.477-1 

/ usr / local / bin / dynamodb-local

#!/bin/sh

set -e

# For information on DynamoDb Local options, see
# https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.UsageNotes.html

# TODO: Error if JRE isn't found/correct version

# Configure local default options in $etcFile
# Any local default can be overridden by specifying env vars
# e.g. 
#   DDB_IN_MEMORY=true DDB_PORT=9001 ./dynamodb-local
# or
#   export DDB_IN_MEMORY=true
#   export DDB_PORT=9001
#   ./dynamodb-local

# Load local defaults, with env var overrides applied
etcFile='/etc/dynamodb-local/default-settings'
. $etcFile

# Validate env vars and set java command args.
[ "$DDB_CORS" != "*" ] && corsArg="-cors '${DDB_CORS}'"

if [ "$DDB_DB_PATH" != "" ]; then
  if $DDB_IN_MEMORY; then
    echo "ERROR: -inMemory cannot be true if -dbPath is specified"
    echo "  - DDB_IN_MEMORY env var is set to true"
    echo "  - DDB_DB_PATH env var is set to $DDB_DB_PATH"
    exit 1
  fi
  dbPathArg="-dbPath $DDB_DB_PATH"
fi

$DDB_DELAY && delayArg='-delayTransientStatuses'

$DDB_IN_MEMORY && inMemoryArg='-inMemory'

if $DDB_OPTIMIZE_DB; then
  if [ "$DDB_DB_PATH" = "" ]; then
    echo "ERROR: -dbPath is required if -optimizeDbBeforeStartup is used"
    echo "  - DDB_DB_PATH env var is not set"
    echo "  - DDB_OPTIMIZE_DB env var is set to true"
    exit 1
  fi
  optimizeDbArg="-optimizeDbBeforeStartup"
fi

[ "$DDB_PORT" != '8000' ] && portArg="-port $DDB_PORT"

$DDB_SHARED_DB && sharedDbArg='-sharedDb'

# Start the dynamodb-local server
command="java -jar /usr/local/lib/dynamodb-local/DynamoDBLocal.jar \
  $corsArg $dbPathArg $delayArg $inMemoryArg \
  $optimizeDbArg $portArg $sharedDbArg"

echo "exec $command"
exec $command