# adjust this file to your needs
# find a current recommended version here: https://git.panter.ch/panter/catladder2/-/blob/master/includes/envrc

# if catladder is available, invoke that
if hash catladder 2>/dev/null; then
  watch_file values*.yml
  eval "$(catladder --catenv)"
fi
# additionaly load env vars from .env files
watch_file .env
if [ -f .env ]; then

  set -o allexport
  source .env
  set +o allexport
fi


# install nvm automatically and install correct node version
# remove this if you are not using node or have other concerns
# see https://github.com/direnv/direnv/wiki/Node#using-nvm for alternatives
use_nvm() {
  local NVM_PATH="$HOME/.nvm/nvm.sh"
  if ! [ -f "$NVM_PATH" ]; then
    echo "Installing NVM" >&2
    curl -o- https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
  fi
  . "${NVM_PATH}"
  nvm install
  layout node
}
watch_file .nvmrc
if [ -f .nvmrc ]; then
  use_nvm
fi