You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

35 lines
789 B

#!@l_bash@
##
## arangomkdb.sh -- ArangoDB database creation utility
##
# get information
if [ $# -ge 1 ]; then
database="$1"; shift
else
read -p "database: " -e database
fi
if [ $# -ge 1 ]; then
username="$1"; shift
else
read -p "username: " -e -i $database username
fi
if [ $# -ge 1 ]; then
password="$1"; shift
else
read -p "password: " -e -s password
echo ""
fi
read -p "root password: " -e -s rootpw
# generate the JavaScript code to create database
js="db._createDatabase(\"$username\", [], ["
js="$js { username: \"root\", passwd: \"$rootpw\" },"
js="$js { username: \"$username\", passwd: \"$password\" } ]);"
# execute the JavaScript code
echo "$js" | \
@l_prefix@/bin/arangosh \
--server.username root \
--server.password "$rootpw"