UNPKG

@codai/cbd

Version:

Codai Better Database - High-Performance Vector Memory System with HPKV-inspired architecture and MCP server

45 lines • 2.12 kB
/** * Add Let's Encrypt ACME Challenge to CBD Universal Database * This script adds the specific challenge token needed for SSL certificate validation */ import { CBDUniversalServiceSimple } from './CBDUniversalService.js'; // Challenge details from Let's Encrypt const CHALLENGE_TOKEN = '1f1sScbQuBJBH47FNJzp9mGz7U27ZecznuyoQWAUkUQ'; const CHALLENGE_RESPONSE = '1f1sScbQuBJBH47FNJzp9mGz7U27ZecznuyoQWAUkUQ.uup0Q8uNsfMv97K8WFaC0ubO7nRMrn8YvocDBW8JxPM'; async function setupSSLChallenge() { console.log('šŸ” Setting up Let\'s Encrypt SSL Challenge...'); try { // Create CBD service instance const service = new CBDUniversalServiceSimple(); // Add the challenge to the ACME handler service.acmeHandler.addChallenge(CHALLENGE_TOKEN, CHALLENGE_RESPONSE); console.log('āœ… Challenge added successfully!'); console.log(`šŸ“ Challenge URL: http://cbd.memorai.ro/.well-known/acme-challenge/${CHALLENGE_TOKEN}`); console.log(`šŸ“‹ Response: ${CHALLENGE_RESPONSE.substring(0, 50)}...`); // Initialize and start the service const app = await service.initialize(); const port = process.env.PORT || 4180; const server = app.listen(port, () => { console.log(`šŸš€ CBD Universal Database with SSL Challenge running on port ${port}`); console.log(`šŸ”— Test challenge: curl http://localhost:${port}/.well-known/acme-challenge/${CHALLENGE_TOKEN}`); console.log('šŸŽÆ Ready for Let\'s Encrypt validation!'); }); // Graceful shutdown process.on('SIGINT', () => { console.log('\nšŸ›‘ Shutting down CBD service...'); server.close(() => { console.log('āœ… CBD service stopped.'); process.exit(0); }); }); } catch (error) { console.error('āŒ Failed to setup SSL challenge:', error); process.exit(1); } } // Only run if this file is executed directly if (import.meta.url === `file://${process.argv[1]}`) { setupSSLChallenge(); } //# sourceMappingURL=setup-ssl-challenge.js.map