
#!/bin/bash
#
# Welcom to use Bigemap Server
# Copyright(c) 2019 BIGEMAP
#

start() {
  docker-compose up -d

  if [ $? -ne 0 ]; then
    exit 1
  fi

  echo '
Bigemap Server running ...

  http://<your-ip-address>:3000
  
Default:

  http://localhost:3000
'
}

stop() {
  docker-compose stop
}

logs() {
  docker-compose logs
}

version() {
  echo "v1.4.0-slim"
}

usage() {
  echo "
Welcom to use Bigemap Server
For more infomation, please visit http://www.bigemap.com/offlinemaps
Version: v1.4.0-slim

Usage: ./bm-server [command]

Commands:
  start               Start Bigemap Server
  stop                Stop Bigemap Server
  restart             Restart Bigemap Server
  logs                View Bigemap Server logs

Notes:

  Publish offline map services:
  Copy the directory downloaded by Bigemap into bm-server//tilesets
  see also http://www.bigemap.com/helps/doc20190104122.html

"
}

case $1 in
"start") start ;;
"stop") stop ;;
"restart") 
  stop
  start
  ;;
"logs") logs ;;
"version") version ;;
*) usage ;;
esac

