Skip to main content
Glama
generate-config.js1.33 kB
const fs = require('fs'); const path = require('path'); // Try to load dotenv try { require('dotenv').config({ path: '.env.local' }); } catch (e) { console.warn('⚠️ dotenv not installed, using process.env directly'); } const templatePath = path.join(__dirname, '..', 'wrangler.jsonc.template'); const outputPath = path.join(__dirname, '..', 'wrangler.jsonc'); // Check if template exists if (!fs.existsSync(templatePath)) { console.error('❌ Error: wrangler.jsonc.template not found!'); process.exit(1); } // Read template const template = fs.readFileSync(templatePath, 'utf8'); // Check for required environment variables const KV_ID = process.env.KV_ID; const D1_ID = process.env.D1_ID; if (!KV_ID) { console.error('❌ Error: KV_ID not found in environment variables'); console.error('Please set KV_ID in .env.local file'); process.exit(1); } if (!D1_ID) { console.error('❌ Error: D1_ID not found in environment variables'); console.error('Please set D1_ID in .env.local file'); process.exit(1); } // Replace placeholders const config = template .replace('<ADD-KV-ID>', KV_ID) .replace('<ADD-D1-ID>', D1_ID); // Write output fs.writeFileSync(outputPath, config); console.log('✓ Generated wrangler.jsonc from template'); console.log(` KV_ID: ${KV_ID}`); console.log(` D1_ID: ${D1_ID}`);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ross-jill-ws/cloudflare-mcp-lab'

If you have feedback or need assistance with the MCP directory API, please join our Discord server