Added function for generateing test envs
This commit is contained in:
parent
972b09d8ca
commit
fc37d14620
27
create_testenv.ts
Normal file
27
create_testenv.ts
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import consola from "consola";
|
||||||
|
import fs from "fs";
|
||||||
|
import nodemailer from "nodemailer";
|
||||||
|
|
||||||
|
|
||||||
|
nodemailer.createTestAccount((err, account) => {
|
||||||
|
if (err) {
|
||||||
|
console.error('Failed to create a testing account. ' + err.message);
|
||||||
|
return process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const env = `
|
||||||
|
NODE_ENV=dev
|
||||||
|
MAIL_SERVER=${account.smtp.host}
|
||||||
|
MAIL_PORT=${account.smtp.port}
|
||||||
|
MAIL_USER=${account.user}
|
||||||
|
MAIL_PASSWORD=${account.pass}
|
||||||
|
MAIL_FROM=${account.user}`
|
||||||
|
|
||||||
|
try {
|
||||||
|
fs.writeFileSync("./.env", env, { encoding: "utf-8" });
|
||||||
|
consola.success("Exported ci env to .env");
|
||||||
|
} catch (error) {
|
||||||
|
consola.error("Couldn't export the ci env");
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user