Environment Configuration
All configuration is done through environment variables in the .env file.
Complete .env Template
env
# ============================================
# SERVER CONFIGURATION
# ============================================
PORT=3000
SECRET=your-secure-random-string-here
# ============================================
# LTI 1.3 CONFIGURATION (from D2L Admin)
# ============================================
LTI_CLIENT_ID=your-client-id-from-d2l
LTI_DEPLOYMENT_ID=your-deployment-id-from-d2l
# ============================================
# GRADESCOPE CREDENTIALS (Instructor Account)
# ============================================
TOKEN=your-gradescope-authenticity-token
COOKIE=your-gradescope-session-cookie
# ============================================
# GRADESCOPE COURSE INFO
# ============================================
COURSE_ID=1106756
# ============================================
# OPTIONAL: DEBUG MODE
# ============================================
DEBUG=falseVariable Reference
Server Configuration
| Variable | Required | Default | Description |
|---|---|---|---|
PORT | No | 3000 | HTTP server port |
SECRET | Yes | — | Secret key for signing tokens. Use a long random string (32+ characters) |
Generating a Secret
bash
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"LTI Configuration
| Variable | Required | Description |
|---|---|---|
LTI_CLIENT_ID | Yes | Client ID from D2L LTI registration |
LTI_DEPLOYMENT_ID | Yes | Deployment ID from D2L LTI registration |
These values come from your D2L administrator after registering the LTI tool. See D2L Integration.
Gradescope Credentials
| Variable | Required | Description |
|---|---|---|
TOKEN | Yes | Gradescope authenticity token (CSRF token) |
COOKIE | Yes | Gradescope session cookie |
COURSE_ID | Yes | Your Gradescope course ID (from URL) |
Credential Expiration
Gradescope sessions expire periodically. You'll need to update TOKEN and COOKIE when submissions start failing.
Getting Gradescope Credentials
Method 1: Browser Developer Tools
- Log into Gradescope as an instructor
- Open Developer Tools (F12 or right-click → Inspect)
- Go to the Network tab
- Navigate to any assignment page
- Click on any request to
gradescope.com - In Headers, find:
- Cookie: Copy the entire cookie string
- Look for
authenticity_tokenin form data or page source
Method 2: Browser Console
- Log into Gradescope
- Open Developer Tools → Console
- Run:
javascript
// Get cookie
document.cookie
// Get authenticity token (if on a form page)
document.querySelector('input[name="authenticity_token"]')?.valueFinding Your Course ID
Your course ID is in the Gradescope URL:
https://www.gradescope.com/courses/1106756
^^^^^^^
This is your COURSE_IDSecurity Best Practices
Never Commit .env
The .env file contains sensitive credentials. Never commit it to version control.
- Add to .gitignore — Already done in the repository
- Use environment variables on production — Set via your hosting provider
- Rotate credentials — Update Gradescope credentials monthly
- Strong SECRET — Use a cryptographically random string
Updating Credentials
When Gradescope sessions expire:
- Log into Gradescope again
- Get fresh
TOKENandCOOKIEvalues - Update your
.envfile - Restart the server:
bash
pm2 restart gradescope-submitter