()
| 295 | |
| 296 | // Function to update .dev.vars with secure random string |
| 297 | async 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 |
| 317 | async function runDatabaseMigrations(dbName: string) { |
no test coverage detected