2013-06-11 23:13:50 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2013-06-13 16:43:09 +08:00
|
|
|
verbose=no
|
|
|
|
|
|
|
|
while test -n "$1"; do
|
|
|
|
if test "$1" = "-v"; then
|
|
|
|
verbose=yes
|
|
|
|
else
|
|
|
|
cfg=$1
|
|
|
|
fi
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
if test -z "$cfg"; then
|
|
|
|
echo "Usage: $0 [-v] <config_file>" >&2
|
2013-06-11 23:13:50 +08:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
port=8181
|
|
|
|
user=dev
|
|
|
|
domain=localhost.lan
|
|
|
|
proto=http
|
2013-06-13 00:30:32 +08:00
|
|
|
path="tiles/layergroup"
|
2013-06-11 23:13:50 +08:00
|
|
|
|
2013-06-13 00:30:32 +08:00
|
|
|
# This is for direct windshaft connection
|
|
|
|
#port=8083
|
|
|
|
#path="database/cartodb_dev_user_1_db/layergroup"
|
2013-06-11 23:13:50 +08:00
|
|
|
|
2013-07-04 17:15:21 +08:00
|
|
|
cmd="curl -skH Content-Type:application/json --data-binary @${cfg} ${proto}://${user}.${domain}:${port}/${path}"
|
|
|
|
if test x${verbose} = xyes; then
|
|
|
|
cmd="${cmd} -v"
|
|
|
|
fi
|
2013-07-04 17:04:12 +08:00
|
|
|
res=`${cmd}`
|
|
|
|
if test $? -gt 0; then
|
|
|
|
echo "curl command failed: ${cmd}"
|
|
|
|
fi
|
2013-06-13 16:43:09 +08:00
|
|
|
|
|
|
|
if test x${verbose} = xyes; then
|
|
|
|
echo "${res}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
tok=`echo "$res" | sed 's/.*"layergroupid":"\([^"]*\)".*/\1/'`
|
|
|
|
echo $tok
|