add to .gitignore config.json and create server.js
This commit is contained in:
parent
cdc83ffba6
commit
f92557ea85
2
.gitignore
vendored
2
.gitignore
vendored
@ -130,3 +130,5 @@ dist
|
|||||||
.yarn/install-state.gz
|
.yarn/install-state.gz
|
||||||
.pnp.*
|
.pnp.*
|
||||||
|
|
||||||
|
# Project
|
||||||
|
config.json
|
||||||
|
24
server.js
Normal file
24
server.js
Normal file
@ -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"]);
|
Loading…
Reference in New Issue
Block a user