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:

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_ALLOWLIST

When 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

  1. Go to your Worker: Workers & Pages → ihnyc-rc-vote
  2. Navigate to Settings → Variables and Secrets
  3. Under “Secrets” section, click “Add secret”
  4. Name: NOTION_DATABASE_ALLOWLIST
  5. Value: Your allowlist (JSON array or comma-separated format)
  6. Click “Encrypt”

Option 3: Environment Variables (Alternative)

If you prefer to use Environment Variables instead of Secrets:

  1. Go to Workers & Pages → ihnyc-rc-vote → Settings → Variables and Secrets
  2. Under “Environment Variables” section, click “Add variable”
  3. Name: NOTION_DATABASE_ALLOWLIST
  4. Value: Your allowlist
  5. Click “Save”

Finding Your Notion Database IDs

To get your Notion database ID:

  1. Open your Notion database in a browser
  2. Look at the URL: https://www.notion.so/workspace/DATABASE_ID?v=...
  3. The database ID is the long string of characters (32 characters, with dashes)
  4. 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 deploy

Verify it’s set:

wrangler secret list

Troubleshooting:

If you see “No databases configured” in the UI after setting the secret:

  1. Make sure you redeployed after setting the secret:

    npm run deploy
  2. Check the browser console (F12 → Console) for any errors when loading the create election page

  3. 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)

  4. Test locally by adding to .dev.vars:

    NOTION_DATABASE_ALLOWLIST=NOTION_DB_ID_PROPOSAL_DRAFTS:Proposal Drafts,NOTION_DB_ID_ANY_VOTING:Any Voting
    

    Then run npm run dev and 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