Files
adopt-a-street/deploy/k8s/configmap.yaml
William Valentin fc23f4d098 feat: add admin user system with role-based access control
Implement comprehensive admin user system for Kubernetes deployment:

Backend:
- Add isAdmin field to User model for role-based permissions
- Create adminAuth middleware to protect admin-only routes
- Protect 11 routes across rewards, cache, streets, and analytics endpoints
- Update setup-couchdb.js to seed default admin user at deployment

Kubernetes:
- Add ADMIN_EMAIL and ADMIN_PASSWORD to secrets.yaml
- Add ADMIN_EMAIL to configmap.yaml for non-sensitive config
- Create couchdb-init-job.yaml for automated database initialization
- Update secrets.yaml.example with admin user documentation

Frontend:
- Create AdminRoute component for admin-only page protection
- Create comprehensive AdminDashboard with 5 tabs:
  * Overview: Platform statistics and quick actions
  * Users: List, search, manage admin status, delete users
  * Streets: Create, edit, delete streets
  * Rewards: Create, edit, toggle, delete rewards
  * Content: Moderate posts and events
- Add Admin navigation link in Navbar (visible only to admins)
- Integrate admin routes in App.js

Default admin user:
- Email: will@wills-portal.com
- Created automatically by K8s init job at deployment

Routes protected:
- POST/PUT/DELETE /api/rewards (catalog management)
- POST /api/streets (street creation)
- DELETE /api/cache (cache operations)
- GET /api/analytics/* (platform statistics)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-06 13:36:15 -08:00

35 lines
1006 B
YAML

apiVersion: v1
kind: ConfigMap
metadata:
name: adopt-a-street-config
data:
# CouchDB Connection
COUCHDB_URL: "http://adopt-a-street-couchdb:5984"
COUCHDB_DB_NAME: "adopt-a-street"
# CouchDB Connection Pool Settings (optional)
COUCHDB_MAX_CONNECTIONS: "10"
COUCHDB_REQUEST_TIMEOUT: "30000"
# Backend Configuration
PORT: "5000"
NODE_ENV: "production"
# Frontend URL (update with your actual domain)
FRONTEND_URL: "http://adopt-a-street.local"
# Cloudinary Configuration (non-sensitive values only)
# Note: CLOUDINARY_API_SECRET should be in secrets.yaml
CLOUDINARY_CLOUD_NAME: "your-cloudinary-cloud-name"
# Stripe Configuration (optional - currently mocked)
# Note: STRIPE_SECRET_KEY should be in secrets.yaml
STRIPE_PUBLISHABLE_KEY: "your-stripe-publishable-key"
# OpenAI Configuration (optional - for AI features)
# Note: OPENAI_API_KEY should be in secrets.yaml
OPENAI_MODEL: "gpt-3.5-turbo"
# Admin Configuration
ADMIN_EMAIL: "will@wills-portal.com"