MCPcopy Index your code
hub / github.com/supermemoryai/cloudflare-saas-stack / updateDevVarsWithSecret

Function updateDevVarsWithSecret

scripts/setup.ts:297–314  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

295
296// Function to update .dev.vars with secure random string
297async function updateDevVarsWithSecret() {
298 const secret = generateSecureRandomString(32);
299 const devVarsPath = path.join(__dirname, "..", ".dev.vars");
300
301 try {
302 if (!fs.readFileSync(devVarsPath, "utf-8").includes("AUTH_SECRET")) {
303 fs.appendFileSync(devVarsPath, `\nAUTH_SECRET=${secret}`);
304 console.log("\x1b[33mSecret appended to .dev.vars file.\x1b[0m");
305 } else {
306 console.log("\x1b[31mAUTH_SECRET already exists in .dev.vars\x1b[0m");
307 }
308 } catch (error) {
309 console.error("\x1b[31mError updating .dev.vars file:", error, "\x1b[0m");
310 cancel("Operation cancelled.");
311 }
312
313 outro(".dev.vars updated with secure secret.");
314}
315
316// Function to run database migrations
317async function runDatabaseMigrations(dbName: string) {

Callers 1

mainFunction · 0.85

Calls 1

Tested by

no test coverage detected