#!/bin/bash -e

#
# The scripts 01 - 0X were run to build an instance; then an AMI was created.
#
# An instance was just created from that AMI, and this script must build the
# environment for this instances new 'location' within the cluster.
#

eval "$(cli-shezargs $@)"

jsaws-set-env SERVERASSIST_MY_IP "$(curl -s 'http://169.254.169.254/latest/meta-data/local-ipv4')"

my_keyname="$(curl -s http://169.254.169.254/latest/meta-data/public-keys/ | cut -d= -f2)"
if [[ $my_keyname =~ prod ]]; then
  jsaws-set-env NODE_ENV production
else
  jsaws-set-env NODE_ENV development
fi

