-
Notifications
You must be signed in to change notification settings - Fork 3
/
.envrc
30 lines (25 loc) · 709 Bytes
/
.envrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
layout_poetry() {
if [[ -f backend/pyproject.toml ]]; then
local VENV=$( cd backend && poetry show -v|grep "Using virtualenv:"|cut -f 3 -d " " 2>/dev/null)
export VIRTUAL_ENV=$VENV
PATH_add "$VIRTUAL_ENV/bin"
fi
}
set -e
# check if python version is set in current dir
if [ -f ".python-version" ] ; then
if [ ! -d ".venv" ] ; then
echo "Installing virtualenv for $(python -V)"
python -m venv .venv
fi
echo "Activating $(python -V) virtualenv"
source .venv/bin/activate
fi
layout node
layout_poetry
# load local environment variables
if [ -f ".env" ] ; then
dotenv .env
else
echo "Unable to find .env. Please see README for configuring environment."
fi