#!/bin/sh

# Sets and enables heart (recommended only in daemon mode)
# case $RELEASE_COMMAND in
#   daemon*)
#     HEART_COMMAND="$RELEASE_ROOT/bin/$RELEASE_NAME $RELEASE_COMMAND"
#     export HEART_COMMAND
#     export ELIXIR_ERL_OPTIONS="-heart"
#     ;;
#   *)
#     ;;
# esac

echo " "
echo "                    -= Xmplry v<%= @release.version %> =-"
echo "                                 "
echo "      Elixir:" <%= @release.applications.elixir[:vsn] %>
echo "        ERTS:" <%= @release.erts_version %>
echo " "

echo "     MIX_ENV:" <%= System.get_env("MIX_ENV") %>

# configure node for distributed erlang with IPV6 support
export ERL_AFLAGS="-proto_dist inet6_tcp -kernel shell_history enabled"
export ECTO_IPV6="true"
export DNS_CLUSTER_QUERY="${FLY_APP_NAME}.internal"
export RELEASE_DISTRIBUTION="name"
export RELEASE_NODE="${FLY_APP_NAME}-${FLY_IMAGE_REF##*-}@${FLY_PRIVATE_IP}"
echo "RELEASE_NODE:" $RELEASE_NODE
echo "---"