From 6879722f1bebc2d1fcd1dadcb77470a1da73397b Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Thu, 18 Aug 2022 02:41:32 +0600 Subject: бля все время забываю эту хуйню Despair stage 3 .. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Main.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Main.ts b/src/Main.ts index 30368e9..b218739 100644 --- a/src/Main.ts +++ b/src/Main.ts @@ -26,6 +26,7 @@ import ProfileRouter from "./routers/Profile"; import AuthRouter from "./routers/Auth"; import ImageRouter from "./routers/Image"; import { PrismaClient } from "@prisma/client"; +import { readFileSync } from "fs"; const log: Logger = new Logger({name: "main"}); @@ -56,18 +57,18 @@ function Main(dirPath: string, cfg: {[key: string]: any}, cli_options?: {[key: s if (!cli_options.noSsl) { if ( - !cfg.Certificate.Key || - !cfg.Certificate.Cert || - !cfg.Certificate.Ca + cfg.Certificate.Key == "" || + cfg.Certificate.Cert == "" || + cfg.Certificate.Ca == "" ) { log.error("No paths for certificate provided."); process.exit(1); } const credentials = { - key: cfg.Certificate.Key, - cert: cfg.Certificate.Cert, - ca: cfg.Certificate.Ca + key: readFileSync(cfg.Certificate.Key, {encoding: "utf-8"}), + cert: readFileSync(cfg.Certificate.Cert, {encoding: "utf-8"}), + ca: readFileSync(cfg.Certificate.Ca, {encoding: "utf-8"}) } httpsc = https.createServer(credentials, App); -- cgit v1.2.3