mirror of
https://github.com/Expand-sys/ccashfrontend
synced 2025-12-17 07:12:12 +11:00
https support
This commit is contained in:
parent
7dbd063c61
commit
0d6046945a
1 changed files with 19 additions and 5 deletions
24
index.js
24
index.js
|
|
@ -1,18 +1,32 @@
|
||||||
const root = process.env.PWD;
|
const root = process.env.PWD;
|
||||||
require("pino-pretty");
|
require("pino-pretty");
|
||||||
const fastify = require("fastify")({
|
const dotenv = require("dotenv");
|
||||||
//logger: { prettyPrint: true },
|
|
||||||
});
|
dotenv.config({ path: ".env" });
|
||||||
|
if (process.env.SECURE) {
|
||||||
|
const fastify = require("fastify")({
|
||||||
|
http2: true,
|
||||||
|
https: {
|
||||||
|
allowHTTP1: true, // fallback support for HTTP1
|
||||||
|
key: fs.readFileSync(path.join(root, "..", "config", "key.key")),
|
||||||
|
cert: fs.readFileSync(path.join(root, "..", "config", "cert.cert")),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const fastify = require("fastify")({
|
||||||
|
//logger: { prettyPrint: true },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const fastifyFlash = require("fastify-flash");
|
const fastifyFlash = require("fastify-flash");
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const got = require("got");
|
const got = require("got");
|
||||||
const url = require("url");
|
const url = require("url");
|
||||||
const dotenv = require("dotenv");
|
|
||||||
|
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const { CCashClient } = require("ccash-client-js");
|
const { CCashClient } = require("ccash-client-js");
|
||||||
dotenv.config({ path: ".env" });
|
|
||||||
fastify.register(require("fastify-formbody"));
|
fastify.register(require("fastify-formbody"));
|
||||||
fastify.register(require("fastify-static"), {
|
fastify.register(require("fastify-static"), {
|
||||||
root: path.join(__dirname, "public"),
|
root: path.join(__dirname, "public"),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue