File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ bash scripts/smoke-one.sh
5353``` bash
5454cp .env.example .env
5555# set OPENAI_BASE_URL and OPENAI_API_KEY for your provider
56+ bash scripts/validate-env.sh
5657bash scripts/smoke-external.sh
5758```
5859
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ if [ ! -f .env ]; then
55 echo " Create .env from .env.example and set OPENAI_BASE_URL/OPENAI_API_KEY first." >&2
66 exit 1
77fi
8+ ./scripts/validate-env.sh
89cleanup (){ docker compose -f compose.external.yml down -v > /dev/null 2>&1 || true ; }
910trap cleanup EXIT
1011
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
4+ cd " $( dirname " $0 " ) /.."
5+
6+ ENV_FILE=" .env"
7+ if [ ! -f " $ENV_FILE " ]; then
8+ echo " Missing .env (copy from .env.example first)." >&2
9+ exit 1
10+ fi
11+
12+ required=(
13+ OPENAI_BASE_URL
14+ OPENAI_API_KEY
15+ MEM0_LLM_MODEL
16+ MEM0_EMBED_MODEL
17+ QDRANT_COLLECTION
18+ )
19+
20+ # At least one Qdrant endpoint form must be present
21+ has_qdrant_url=0
22+ has_qdrant_hostport=0
23+
24+ if grep -Eq ' ^QDRANT_URL=.+$' " $ENV_FILE " ; then
25+ has_qdrant_url=1
26+ fi
27+ if grep -Eq ' ^QDRANT_HOST=.+$' " $ENV_FILE " && grep -Eq ' ^QDRANT_PORT=.+$' " $ENV_FILE " ; then
28+ has_qdrant_hostport=1
29+ fi
30+
31+ missing=()
32+ for key in " ${required[@]} " ; do
33+ if ! grep -Eq " ^${key} =.+$" " $ENV_FILE " ; then
34+ missing+=(" $key " )
35+ fi
36+ done
37+
38+ if [ ${# missing[@]} -gt 0 ]; then
39+ echo " Missing required env vars in .env: ${missing[*]} " >&2
40+ exit 1
41+ fi
42+
43+ if [ " $has_qdrant_url " -eq 0 ] && [ " $has_qdrant_hostport " -eq 0 ]; then
44+ echo " Missing Qdrant endpoint: set QDRANT_URL or both QDRANT_HOST and QDRANT_PORT." >&2
45+ exit 1
46+ fi
47+
48+ echo " env-validate: OK"
You can’t perform that action at this time.
0 commit comments