Required Environment Variables
The workers require four environment variables to function:| Variable | Purpose |
|---|---|
NOTION_TOKEN | Notion integration token (never log or expose) |
DOCS_DATABASE_ID | Docs database ID (32-char hex, no dashes) |
HOME_DOCS_DATABASE_ID | Home Docs database ID |
TASKS_DATABASE_ID | Tasks database ID (for handoff tasks) |
Credential Options
Option A: 1Password (Maintainers)
For team members with access to the 1Password vault, run the automated secret loader:- Fetches credentials from the “JRE Notion Workers - API Credentials” 1Password item
- Generates a
.envfile with all required variables - Uses the “Dev” vault by default (override with
OP_VAULTenvironment variable)
Script Requirements
Script Requirements
- 1Password CLI (
op) installed and authenticated - Access to the Dev vault (or specified vault)
- The “JRE Notion Workers - API Credentials” item
Option A1: 1Password + Cursor Hooks
For Cursor users, this project supports 1Password Cursor Hooks to mount secrets without storing plaintext on disk.Install Requirements
- 1Password (Mac or Linux)
- Cursor IDE
sqlite3in your PATH
Configure 1Password Environment
In 1Password:
- Create an Environment (e.g., “Notion Workers”)
- Add a Mount .env file destination pointing to
.env.local(or.env) in your project - Add these fields to the Environment:
NOTION_TOKENDOCS_DATABASE_IDHOME_DOCS_DATABASE_IDTASKS_DATABASE_ID
Enable the Mount
In the 1Password app:
- Navigate to Destinations
- Find your local .env file destination
- Toggle Enabled
- Restart Cursor
Verify Hook Operation
The repository includes:
.cursor/hooks.json— Hook configuration.cursor/hooks/1password/validate-mounted-env-files.sh— Validation script.1password/environments.toml— Lists paths to validate (.env.localand.env)
Logs are written to
/tmp/1password-cursor-hooks.log. Enable debug mode by setting DEBUG=1.Troubleshooting: Hook Keeps Blocking
Troubleshooting: Hook Keeps Blocking
Problem: The hook denies access and blocks commands.Solutions:
-
Workspace Root: Open Cursor with this project folder as the workspace root:
- File → Open Folder →
jre-notion-workers - NOT a parent folder
- The hook resolves
.env.localrelative to the workspace root Cursor sends
- File → Open Folder →
-
Check Logs: Open the log file to see why it was denied:
- File → Open File →
/tmp/1password-cursor-hooks.log - Look for “Required local .env file is missing or invalid”
- Verify the path matches your 1Password mount path exactly
- File → Open File →
- Verify Mount: Ensure the mount is enabled in 1Password app and the destination path is correct.
Option A2: 1Password CLI (op run)
For terminal use without Cursor hooks, use secret references with the 1Password CLI:
See Load secrets into the environment for more details.
Option B: Manual Configuration
For contributors without 1Password access, manually create a.env file:
Using .env.local
If you keep credentials in.env.local (e.g., exported from 1Password), that file is also gitignored.
Development:
Test Environment Variables
For integration tests, use separate test credentials to avoid touching production data:TEST_DOCS_DATABASE_ID is not set.
Deployed Worker Secrets
For production deployment, set secrets via thentn CLI:
process.env variables in the deployed worker runtime.
Safe to Commit
These files are safe to commit and are tracked in git:.env.example.env.1p (secret references)scripts/load-secrets.sh.cursor/hooks.json.cursor/hooks/1password/*.1password/environments.tomlSecurity Best Practices
Never Log Tokens
Never log or expose
NOTION_TOKEN in console output, errors, or debug statements.Separate Environments
Keep test credentials completely separate from production credentials.
Use Shared Client
Always use
getNotionClient() from src/shared/notion-client.ts — never hardcode tokens.Validate on Start
Use
test:connection scripts to verify credentials before running workers.Next Steps
Setup Guide
Complete the local development setup
Testing Guide
Run tests with your configured credentials
Deployment
Deploy workers with production secrets