Fixing persistance
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Fabian Stamm 2020-01-07 22:48:02 +01:00
parent 87e33a3bd0
commit a686ce24cc
2 changed files with 7 additions and 5 deletions

View File

@ -17,6 +17,4 @@ COPY lib/ /usr/src/app/lib
VOLUME [ "/usr/src/app/logs", "/usr/src/app/persist"]
EXPOSE 3006/tcp
CMD ["npm", "run", "start"]

View File

@ -3,6 +3,7 @@ require('ssl-root-cas').inject();
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
import Logging from "@hibas123/nodelogging";
import * as fs from "fs";
import * as dotenv from "dotenv";
dotenv.config();
@ -14,7 +15,11 @@ import { createHash } from "crypto";
import low from "lowdb";
import FileSync from "lowdb/adapters/FileSync";
const adapter = new FileSync<{ test }>("db.json");
if (!fs.existsSync("./persist")) {
fs.mkdirSync("./persist")
}
const adapter = new FileSync<{ test }>("persist/db.json");
const db = low(adapter);
db.defaults({});
import { createTransport } from "nodemailer";
@ -71,9 +76,8 @@ async function check() {
}
import Telegraf from "telegraf";
import * as fs from "fs";
const bot = new Telegraf(process.env.TG_TOKEN)
const chatidFilename = "./chatid";
const chatidFilename = "./persist/chatid";
let chatid: number;
try {
if (fs.existsSync(chatidFilename)) {