#!/bin/bash

sqlite_file=$(echo "$RINGSPACE_DATABASE_URL" | sed "s/sqlite:\/\///" | sed "s/?mode=.*//")
touch .env

if [ ! -f $sqlite_file ]; then
  /bin/ringspace migrate
  /bin/ringspace ring add \
  -n "${RINGSPACE_RING_NAME}" \
  -r "${RINGSPACE_RING_URL}" \
  -d "${RINGSPACE_RING_DESCRIPTION}" \
  -f
fi
/bin/ringspace server

