Monorepo for Aesthetic.Computer aesthetic.computer
at main 107 lines 3.8 kB view raw
1#!/usr/bin/env node 2 3/** 4 * Setup Script for Painting Tools 5 * 6 * Helps configure environment for testing tools locally or against live. 7 */ 8 9console.log(` 10╔═══════════════════════════════════════════════════════════════╗ 11║ 🎨 Painting Tools Setup ║ 12╚═══════════════════════════════════════════════════════════════╝ 13 14This script will help you set up the environment for the painting tools. 15 16You'll need: 17 1. MongoDB connection (local or live) 18 2. Digital Ocean Spaces credentials (for inspecting storage) 19 3. API endpoint (local server or live) 20 21`); 22 23const env = process.env; 24 25console.log('Current Configuration:\n'); 26 27// Check MongoDB 28if (env.MONGODB_CONNECTION_STRING && env.MONGODB_NAME) { 29 console.log('✅ MongoDB: Configured'); 30 console.log(` Database: ${env.MONGODB_NAME}`); 31 console.log(` URI: ${env.MONGODB_CONNECTION_STRING.replace(/\/\/.*:.*@/, '//***:***@')}`); 32} else { 33 console.log('❌ MongoDB: Not configured'); 34 console.log(' Set: MONGODB_CONNECTION_STRING and MONGODB_NAME'); 35} 36console.log(); 37 38// Check Digital Ocean 39if (env.DO_SPACES_KEY && env.DO_SPACES_SECRET) { 40 console.log('✅ Digital Ocean Spaces: Configured'); 41 console.log(` Endpoint: ${env.DO_SPACES_ENDPOINT || 'nyc3.digitaloceanspaces.com'}`); 42 console.log(` Bucket: ${env.DO_SPACES_BUCKET || 'aesthetic-computer'}`); 43} else { 44 console.log('❌ Digital Ocean Spaces: Not configured'); 45 console.log(' Set: DO_SPACES_KEY, DO_SPACES_SECRET'); 46} 47console.log(); 48 49// Check API 50if (env.AC_API) { 51 console.log('✅ API Endpoint: Configured'); 52 console.log(` Target: ${env.AC_API}`); 53 console.log(` Type: ${env.AC_API.includes('localhost') ? 'LOCAL' : 'LIVE'}`); 54} else { 55 console.log('⚠️ API Endpoint: Using default'); 56 console.log(' Target: http://localhost:8888'); 57 console.log(' Set AC_API to override'); 58} 59console.log(); 60 61console.log('─'.repeat(65)); 62console.log('\n📝 Setup Instructions:\n'); 63 64if (!env.MONGODB_CONNECTION_STRING) { 65 console.log('1. For local MongoDB:'); 66 console.log(' export MONGODB_CONNECTION_STRING="mongodb://localhost:27017"'); 67 console.log(' export MONGODB_NAME="aesthetic"'); 68 console.log(); 69 console.log(' Or for live MongoDB:'); 70 console.log(' export MONGODB_CONNECTION_STRING="mongodb+srv://user:pass@cluster..."'); 71 console.log(' export MONGODB_NAME="aesthetic"'); 72 console.log(); 73} 74 75if (!env.DO_SPACES_KEY) { 76 console.log('2. For Digital Ocean Spaces:'); 77 console.log(' export DO_SPACES_KEY="your-key"'); 78 console.log(' export DO_SPACES_SECRET="your-secret"'); 79 console.log(' export DO_SPACES_ENDPOINT="nyc3.digitaloceanspaces.com"'); 80 console.log(' export DO_SPACES_BUCKET="aesthetic-computer"'); 81 console.log(); 82} 83 84if (!env.AC_API) { 85 console.log('3. For API endpoint:'); 86 console.log(' export AC_API="http://localhost:8888" # Local'); 87 console.log(' export AC_API="https://aesthetic.computer" # Live'); 88 console.log(); 89} 90 91console.log('─'.repeat(65)); 92console.log('\n🧪 Quick Tests:\n'); 93console.log(' # Test MongoDB connection'); 94console.log(' node inspect-mongodb.mjs --count'); 95console.log(); 96console.log(' # Test Digital Ocean Spaces'); 97console.log(' node inspect-spaces.mjs --recent 5'); 98console.log(); 99console.log(' # Test API endpoints'); 100console.log(' node inspect-api.mjs --tv'); 101console.log(); 102 103if (env.MONGODB_CONNECTION_STRING && env.DO_SPACES_KEY && env.AC_API) { 104 console.log('✨ All configured! Ready to run tools.\n'); 105} else { 106 console.log('⚠️ Some configuration missing. See instructions above.\n'); 107}