#!/usr/bin/env bash
# Automatic environment switching with direnv
# https://direnv.net/

# Load the parent .envrc file in case of a monorepo
command -v source_up_if_exists >/dev/null 2>&1 && source_up_if_exists

# Add the current composer bin directory to $PATH
export PATH=$PATH:$(pwd)/vendor/bin
export PATH=$PATH:$(pwd)/node_modules/.bin
export PATH=$PATH:$(pwd)/tests/node_modules/.bin

# Copy .env.example to .env if necessary
if [ ! -f .env.local ]; then
  cp ./.env.local.example ./.env.local
fi

# Load everything defined in .env.local
set -o allexport; source .env.local; set +o allexport
