# Enable core dumps.
# Our core detection and reporting scripts require cores to be at /var/cores.
# (Matches the value in the setup script).
#
# Note: Aliases are not supported in PipeDream. Please add a function
# to bazel/function.sh

ulimit -c unlimited

if [ -n "$BASH_SOURCE" ]; then
  script_path="${BASH_SOURCE[0]}"
else
  script_path="$0"
fi
script_directory="$(dirname "$(readlink --canonicalize "$script_path")")"

source "$script_directory/bazel/function.sh"
source "$script_directory/tools/inotify_run.sh"

export ZOOX_ETC="${ZOOX_ETC:-/etc/zoox/}"

# The address of our Hashicorp Vault installation.
export VAULT_ADDR=${VAULT_ADDR:-https://vault.zooxlabs.com:8200}

export NDDSHOME=/opt/RTI/rti_connext_dds-5.3.1
export RTI_LICENSE_FILE=/opt/RTI/rti_license.dat

# Set up log paths (deprecated, do not add new LOG_DIR entries.  See RSI-1501)
base_log_dir="$HOME/.log"
export ROS_LOG_DIR="$base_log_dir/ros"
export GOOGLE_LOG_DIR="$base_log_dir/glog"
export PYTHON_LOG_DIR="$base_log_dir/python"
export ELECTRON_LOG_DIR="$base_log_dir/electron"

# Set a sane default for the ROS_MASTER_URI if it isn't already set, so that
# tools like roscore, roslaunch, and other ROS nodes can use it
# These ROS tools set the ROS_PACKAGE_PATH and other ROS environment variables
# that describe the file system layout internally, and legacy tools use fakeros
# ROS_PACKAGE_PATH, so we don't need to set those here
export ROS_MASTER_URI="${ROS_MASTER_URI:-http://localhost:11311}"

# Don't write python byte code files
# NOTE(austin): I've disabled this because I've been seeing errors that look
#               like race conditions with multiple python processes trying to
#               compile the same files simultaneously
export PYTHONDONTWRITEBYTECODE=1
