diff options
| author | ilotterytea <iltsu@alright.party> | 2022-09-25 13:00:51 +0600 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2022-09-25 13:00:51 +0600 |
| commit | f6061d65a0c9d48445e264748216607cf1753d1b (patch) | |
| tree | ccae1fd223ea3f3503ad251a5398382af6847074 | |
| parent | 4c9f27dd9d447c39324ccd45134d970b14493269 (diff) | |
ssl cert and https port are no longer required
| -rw-r--r-- | index.ts | 10 | ||||
| -rw-r--r-- | src/Main.ts | 31 |
2 files changed, 3 insertions, 38 deletions
@@ -28,14 +28,8 @@ if (cli.init) { ClientSecret: "", RedirectURI: "" }, - Certificate: { - Key: "", - Cert: "", - Ca: "" - }, - Ports: { - HTTP: "80", - HTTPS: "443" + Server: { + Port: "8033" } } diff --git a/src/Main.ts b/src/Main.ts index b218739..90f8d40 100644 --- a/src/Main.ts +++ b/src/Main.ts @@ -17,9 +17,6 @@ import express from "express"; import cookieParser from "cookie-parser"; import bodyParser from "body-parser"; -import http from "http"; -import https from "https"; - import { Logger } from "tslog"; import ProfileRouter from "./routers/Profile"; @@ -34,9 +31,6 @@ function Main(dirPath: string, cfg: {[key: string]: any}, cli_options?: {[key: s const App: express.Express = express(); const prisma: PrismaClient = new PrismaClient(); - var httpc: http.Server | null = null; - var httpsc: https.Server | null = null; - App.set("view engine", "ejs"); App.set("views", `${dirPath}/static/ejs`); @@ -50,32 +44,9 @@ function Main(dirPath: string, cfg: {[key: string]: any}, cli_options?: {[key: s App.use(express.static(`${dirPath}/static`)); if (cli_options) { - httpc = http.createServer(App); - httpc.listen(parseInt(cfg.Ports.HTTP), () => { + App.listen(parseInt(cfg.Ports.HTTP), () => { log.info("Image hoster is running on port", cfg.Ports.HTTP); }); - - if (!cli_options.noSsl) { - if ( - cfg.Certificate.Key == "" || - cfg.Certificate.Cert == "" || - cfg.Certificate.Ca == "" - ) { - log.error("No paths for certificate provided."); - process.exit(1); - } - - const credentials = { - 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); - httpsc.listen(parseInt(cfg.Ports.HTTPS), () => { - log.info("Image hoster is running on port", cfg.Ports.HTTPS, "(SSL)"); - }); - } } else { log.error("NO CLI OPTIONS PROVIDED!!!") process.exit(1); |
