Skip to content

fix: add ADMIN_PUBLIC_KEYS to .env.example (fixes #4) - #16

Closed
presidojay1 wants to merge 1 commit into
grantFoxin:mainfrom
presidojay1:fix/issue-4-admin-public-keys
Closed

fix: add ADMIN_PUBLIC_KEYS to .env.example (fixes #4)#16
presidojay1 wants to merge 1 commit into
grantFoxin:mainfrom
presidojay1:fix/issue-4-admin-public-keys

Conversation

@presidojay1

@presidojay1 presidojay1 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #4 - Adds missing ADMIN_PUBLIC_KEYS environment variable to .env.example with comprehensive documentation and startup warning.

Problem

Fresh installs of SentientFi experience mysterious 503 errors on admin routes because ADMIN_PUBLIC_KEYS is not documented in .env.example. Developers have no way to know:

  • That this variable exists
  • What format it requires
  • Which routes require it
  • Why admin endpoints return 503

Changes Made

1. Updated backend/.env.example

  • ✅ Added ADMIN_PUBLIC_KEYS with clear documentation
  • ✅ Explained which admin routes are protected
  • ✅ Provided example format (comma-separated public keys)
  • ✅ Documented consequences of not setting it

2. Updated backend/src/index.ts

  • ✅ Added startup warning when ADMIN_PUBLIC_KEYS is not set
  • ✅ Warning lists affected admin routes clearly
  • ✅ Developers are immediately informed at startup

Admin Routes Protected

The following routes require ADMIN_PUBLIC_KEYS configuration:

  • POST /api/auto-rebalancer/start
  • POST /api/auto-rebalancer/stop
  • POST /api/auto-rebalancer/force-check
  • GET /api/auto-rebalancer/history
  • POST /api/rebalance/history/sync-onchain

Testing

Before Fix

# Fresh install - no indication ADMIN_PUBLIC_KEYS is needed
npm run dev
curl -X POST http://localhost:3001/api/auto-rebalancer/start
# Returns: 503 (no explanation)

After Fix

# Fresh install - clear warning at startup
npm run dev
# Console shows: ⚠️  ADMIN_PUBLIC_KEYS is not set — admin routes will return 503

# Developer knows to add ADMIN_PUBLIC_KEYS to .env
ADMIN_PUBLIC_KEYS=GADMIN123... npm run dev
# Admin routes now work ✅

Closes #4

Impact

  • ✅ No more mysterious 503 errors on fresh installs
  • ✅ Clear path to enabling admin features
  • ✅ Improved developer experience
  • ✅ Better onboarding for new contributors

Files Changed

  • backend/.env.example - Added ADMIN_PUBLIC_KEYS documentation
  • backend/src/index.ts - Added startup warning

Breaking Changes

None - All changes are backward compatible and purely additive.

Checklist

…rantFoxin#4)

- Add ADMIN_PUBLIC_KEYS environment variable to .env.example
- Include comprehensive documentation explaining usage
- Add startup warning when ADMIN_PUBLIC_KEYS is not set
- Prevents admin routes from returning 503 on fresh installs

Closes grantFoxin#4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: ADMIN_PUBLIC_KEYS missing from .env.example — admin routes return 503 on fresh installs

2 participants