#!/bin/sh

# Get remote console for the app
# This needs to be run under the app user account

# Exit on errors
set -e

CURDIR="$PWD"
BINDIR=$(dirname "$0")
cd "$BINDIR"; BINDIR="$PWD"; cd "$CURDIR"

SCRIPT_PREFIX="${SCRIPT_PREFIX:-deploy-}"

. $BINDIR/${SCRIPT_PREFIX}set-env

# Config vars
CURRENT_DIR="<%= current_dir %>"
RELEASE_NAME="<%= release_name %>"

<%= case release_system do %>
<% :mix -> %>
$CURRENT_DIR/bin/$RELEASE_NAME remote
<% :distillery -> %>
$CURRENT_DIR/bin/$RELEASE_NAME remote_console
<% end %>
