File size: 1,414 Bytes
2f95553
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# Quick Environment Setup Script for Linux/Mac
# Usage: source setup_env.sh  or  . setup_env.sh

echo "IITM LLM Quiz Solver - Environment Setup"
echo "========================================"
echo ""

# Check if variables are already set
if [ -n "$QUIZ_SECRET" ]; then
    echo "✓ QUIZ_SECRET is already set"
else
    echo "QUIZ_SECRET is not set"
    read -p "Enter your QUIZ_SECRET (or press Enter to generate one): " secret
    if [ -z "$secret" ]; then
        # Generate a random secret
        secret=$(python3 -c "import secrets; print(secrets.token_urlsafe(32))" 2>/dev/null || openssl rand -base64 24)
        echo "Generated secret: $secret"
    fi
    export QUIZ_SECRET="$secret"
    echo "✓ QUIZ_SECRET set for this session"
fi

if [ -n "$OPENAI_API_KEY" ]; then
    echo "✓ OPENAI_API_KEY is already set"
else
    echo "OPENAI_API_KEY is not set (optional)"
    read -p "Enter your OPENAI_API_KEY (or press Enter to skip): " key
    if [ -n "$key" ]; then
        export OPENAI_API_KEY="$key"
        echo "✓ OPENAI_API_KEY set for this session"
    fi
fi

echo ""
echo "Environment variables configured!"
echo ""
echo "To make these permanent, add to ~/.bashrc or ~/.zshrc:" 
echo "export QUIZ_SECRET=\"$QUIZ_SECRET\"" 
if [ -n "$OPENAI_API_KEY" ]; then
    echo "export OPENAI_API_KEY=\"$OPENAI_API_KEY\""
fi
echo ""
echo "To start the server, run:"
echo "python -m app.main"