The NOTION_DATABASE_ALLOWLIST environment variable configures which Notion databases admins can link elections to. Since this is configuration data (not sensitive), you have several options:
Option 1: Using Wrangler Secret (Recommended for Production)
Even though it’s not sensitive, using secrets keeps all environment config in one place:
# Set the allowlist as a secret
wrangler secret put NOTION_DATABASE_ALLOWLISTWhen prompted, paste your allowlist in one of these formats:
JSON array format (recommended):
[{"id":"abc123def456","name":"Elections Database"},{"id":"ghi789jkl012","name":"Projects DB"}]JSON array with IDs only (name is optional):
[{"id":"abc123def456"},{"id":"ghi789jkl012"}]Comma-separated with names:
abc123def456:Elections Database,ghi789jkl012:Projects DB
USING THESE:
NOTION_DB_ID_PROPOSAL_DRAFTS:Proposal Drafts,NOTION_DB_ID_ANY_VOTING:Any Voting
Comma-separated IDs only (simplest):
abc123def456,ghi789jkl012
Single ID:
abc123def456
Note: If you don’t provide names, the database ID will be displayed in the UI dropdown.
Option 2: Cloudflare Dashboard
- Go to your Worker: Workers & Pages → ihnyc-rc-vote
- Navigate to Settings → Variables and Secrets
- Under “Secrets” section, click “Add secret”
- Name:
NOTION_DATABASE_ALLOWLIST - Value: Your allowlist (JSON array or comma-separated format)
- Click “Encrypt”
Option 3: Environment Variables (Alternative)
If you prefer to use Environment Variables instead of Secrets:
- Go to Workers & Pages → ihnyc-rc-vote → Settings → Variables and Secrets
- Under “Environment Variables” section, click “Add variable”
- Name:
NOTION_DATABASE_ALLOWLIST - Value: Your allowlist
- Click “Save”
Finding Your Notion Database IDs
To get your Notion database ID:
- Open your Notion database in a browser
- Look at the URL:
https://www.notion.so/workspace/DATABASE_ID?v=... - The database ID is the long string of characters (32 characters, with dashes)
- Or use the Notion API to list databases your integration has access to
Example Values
JSON format with name:
[{"id":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","name":"Elections Database"}]JSON format ID only (simplest):
[{"id":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"}]Comma-separated with name:
a1b2c3d4-e5f6-7890-abcd-ef1234567890:Elections Database
Comma-separated ID only:
a1b2c3d4-e5f6-7890-abcd-ef1234567890
Local Development
For local development, add it to your .dev.vars file:
NOTION_DATABASE_ALLOWLIST=[{"id":"abc123","name":"Elections Database"}]After Setting
⚠️ IMPORTANT: After setting a secret, you MUST redeploy your Worker for changes to take effect:
npm run deployVerify it’s set:
wrangler secret listTroubleshooting:
If you see “No databases configured” in the UI after setting the secret:
-
Make sure you redeployed after setting the secret:
npm run deploy -
Check the browser console (F12 → Console) for any errors when loading the create election page
-
Verify the secret format - it should be exactly:
NOTION_DB_ID_PROPOSAL_DRAFTS:Proposal Drafts,NOTION_DB_ID_ANY_VOTING:Any Voting(No quotes, no extra spaces)
-
Test locally by adding to
.dev.vars:NOTION_DATABASE_ALLOWLIST=NOTION_DB_ID_PROPOSAL_DRAFTS:Proposal Drafts,NOTION_DB_ID_ANY_VOTING:Any VotingThen run
npm run devand check if it works locally
Notes
- The allowlist is used to validate which databases admins can select when linking elections
- Database IDs must match exactly (case-sensitive)
- You can update the allowlist anytime by setting the secret/variable again
- Changes take effect after redeployment