Monorepo for Aesthetic.Computer aesthetic.computer
at main 68 lines 2.0 kB view raw
1#!/usr/bin/env node 2// Fix tezos-kidlisp network in production database (via Silo) 3 4import "dotenv/config"; 5import { MongoClient } from "mongodb"; 6 7const connectionString = process.env.MONGODB_CONNECTION_STRING; 8const dbName = process.env.MONGODB_NAME; 9 10console.log("🔧 Fixing tezos-kidlisp network in production database...\n"); 11 12if (!connectionString) { 13 console.error("❌ MONGODB_CONNECTION_STRING not found in .env"); 14 process.exit(1); 15} 16 17const client = new MongoClient(connectionString); 18 19try { 20 await client.connect(); 21 console.log("✅ Connected to MongoDB"); 22 23 const db = client.db(dbName); 24 const secrets = db.collection("secrets"); 25 26 // Check current value 27 const current = await secrets.findOne({ _id: "tezos-kidlisp" }); 28 29 if (!current) { 30 console.log("❌ tezos-kidlisp secret not found!"); 31 process.exit(1); 32 } 33 34 console.log("\nCurrent configuration:"); 35 console.log(` - address: ${current.address}`); 36 console.log(` - network: ${current.network}`); 37 38 if (current.network === "mainnet") { 39 console.log("\n✅ Already set to mainnet, no change needed!"); 40 } else { 41 console.log("\n🔧 Updating network from 'ghostnet' to 'mainnet'..."); 42 43 const result = await secrets.updateOne( 44 { _id: "tezos-kidlisp" }, 45 { $set: { network: "mainnet" } } 46 ); 47 48 if (result.modifiedCount > 0) { 49 console.log("✅ Successfully updated to mainnet!"); 50 51 // Verify 52 const updated = await secrets.findOne({ _id: "tezos-kidlisp" }); 53 console.log("\nVerified:"); 54 console.log(` - address: ${updated.address}`); 55 console.log(` - network: ${updated.network}`); 56 57 console.log("\n🎉 Production database fixed! keep-mint should now work."); 58 } else { 59 console.log("⚠️ No changes made"); 60 } 61 } 62 63 await client.close(); 64 console.log("\n✅ Done!"); 65} catch (error) { 66 console.error("\n❌ Error:", error.message); 67 process.exit(1); 68}