From f92557ea85c54d75a5d5206ca6fa52a1ef947b78 Mon Sep 17 00:00:00 2001 From: fullgream Date: Fri, 16 May 2025 02:42:20 +0300 Subject: [PATCH] add to .gitignore config.json and create server.js --- .gitignore | 2 ++ server.js | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 server.js diff --git a/.gitignore b/.gitignore index ceaea36..67df200 100644 --- a/.gitignore +++ b/.gitignore @@ -130,3 +130,5 @@ dist .yarn/install-state.gz .pnp.* +# Project +config.json diff --git a/server.js b/server.js new file mode 100644 index 0000000..63943a8 --- /dev/null +++ b/server.js @@ -0,0 +1,24 @@ +const Pop3Command = require("node-pop3"); +const fs = require("fs"); + +const initalConfig = `{ + "pop3-config": { + "user": "example@example.com", + "password": "example", + "host": "pop3.example.com", + } +}`; + +try { + fs.readFileSync("./config.json"); +} catch (e) { + fs.writeFileSync("./config.json", initalConfig, { + encoding: "utf-8" + }); + console.warn("WARNING config.json is empty. This file was been created. Please, configure it."); + return process.exit(); +} + +global.config = require("./config.json"); + +const pop3 = new Pop3Command(global.config["pop3-config"]);