-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.envrc
More file actions
30 lines (24 loc) · 889 Bytes
/
.envrc
File metadata and controls
30 lines (24 loc) · 889 Bytes
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
#!/usr/bin/env sh
export VIRTUAL_ENV="$PWD/.venv"
export PATH="$VIRTUAL_ENV/bin:$PATH"
export DEV=1
dotenv
: "${GOOGLE_CLOUD_PROJECT:?set in .env — see .env.example}"
: "${GROUPING_TRAINER_BUCKET:?set in .env — see .env.example}"
export CLOUDSDK_CORE_PROJECT="$GOOGLE_CLOUD_PROJECT"
skip_wandb=0
if ! gcloud auth print-access-token > /dev/null 2>&1; then
printf "gcloud credentials need refresh. Run 'gcloud auth login' now? [Y/n] " > /dev/tty
read -r answer < /dev/tty
if [ "$answer" != "n" ] && [ "$answer" != "N" ]; then
gcloud auth login < /dev/tty || skip_wandb=1
else
skip_wandb=1
fi
fi
if [ "$skip_wandb" = "0" ]; then
WANDB_API_KEY=$(gcloud secrets versions access latest --secret=wandb-api-key)
export WANDB_API_KEY
else
echo "Skipping WANDB_API_KEY fetch — set it in .env or your shell if you need wandb" > /dev/tty
fi