#!/usr/bin/env bash
set -euo pipefail
PATH_add tools/bin
PATH_add node_modules/.bin

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
export NX_WORKSPACE_ROOT=$DIR
# export FOUNDRY_ETH_KEYSTORE=$DIR/keystores

dotenv .env.base
dotenv_if_exists .env.override

if [ -z ${CURRENT_PROFILE+x} ]; then
    tools/bin/use local
    dotenv_if_exists .env.override
fi

green "CURRENT_PROFILE: $CURRENT_PROFILE"

dotenv env/.env.$CURRENT_PROFILE
dotenv_if_exists env/.env.$CURRENT_PROFILE.override
