-
-
Notifications
You must be signed in to change notification settings - Fork 52
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
API keys stored in .env files are not reliably loaded by Cortex at runtime. Users must manually export environment variables for Cortex to detect them.
Expected Behavior
- Cortex should automatically load
.envfile from project root or home directory - API keys in
.envshould be available without manual export
Actual Behavior
.envfile is present with correct API key- Cortex does not detect the key
- Only works after running
export OPENAI_API_KEY=...manually
Steps to Reproduce
- Create
.envfile withOPENAI_API_KEY=sk-... - Run
cortex install nginx --dry-run - Observe API key not detected
- Run
export OPENAI_API_KEY=sk-... - Run command again — now works
Suggested Fix
Ensure python-dotenv is called early in the application startup:
from dotenv import load_dotenv
load_dotenv() # Must be called before accessing os.environAlso check for .env in multiple locations:
- Current directory
~/.cortex/.env/etc/cortex/.env
Environment
- Cortex v0.1.0
- Ubuntu (Effiti team testing)
Reporter
Effiti team via Discord
coderabbitai
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working