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:

/ usr / local / lib / dynamodb-local / systemd / system / dynamodb-local.service

#!/bin/sh

set -e

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

# Configure local default options in $etcFile
# Any local default can be overridden by specifying env vars
# using  the short form (without DDBLOCAL_ prefix)
# e.g. 
#   IN_MEMORY=true PORT=9001 ./dynamodb-local
# or
#   export IN_MEMORY=true
#   ./dynamodb-local

# Load local defaults
etcFile='/etc/dynamodb-local/default-settings'
. $etcFile

# Override local defaults with env vars
dbPath=${DB_PATH:-$DDBLOCAL_DB_PATH}
inMemory=${IN_MEMORY:-$DDBLOCAL_IN_MEMORY}
port=${PORT:-$DDBLOCAL_PORT}
sharedDb=${SHARED_DB:-$DDBLOCAL_SHARED_DB}

$inMemory && inMemoryArg='-inMemory'
[ "$port" != '8000' ] && portArg="-port $port"
$sharedDb && sharedDbArg='-sharedDb'

if [ "$dbPath" != '' ]; then
  if $inMemory; then
    echo "ERROR: -inMemory cannot be true if -dbPath is specified"
    if [ $IN_MEMORY ]; then 
      echo "  - IN_MEMORY env var is set to true"
    else
      echo "  - DDBLOCAL_IN_MEMORY is set to true in $etcFile"
    fi

    if [ "$DB_PATH" != '' ]; then
      echo "  - DB_PATH env var is set to $DB_PATH"
    else
      echo "  - DDBLOCAL_DB_PATH is set to $DDBLOCAL_DB_PATH in $etcFile"
    fi
  fi
  dbPathArg="-dbPath $dbPath"
fi

command="java -jar /usr/local/lib/dynamodb-local/DynamoDBLocal.jar \
  $dbPathArg $inMemoryArg $portArg $sharedDbArg"

echo "executing $command"
$command