1
0
mirror of https://github.com/ragestudio/comty.git synced 2025-06-22 00:44:17 +00:00
2025-05-13 12:50:36 +00:00

25 lines
878 B
JavaScript

import fs from "node:fs"
import path from "node:path"
import Gateway from "./gateway"
const rootSSLDirPath = path.resolve(__dirname, "../../", ".ssl")
const cwdSSLDirPath = path.resolve(__dirname, ".ssl")
if (fs.existsSync(rootSSLDirPath) || fs.existsSync(cwdSSLDirPath)) {
const rootKeyPath = path.resolve(rootSSLDirPath, "privkey.pem")
const rootCertPath = path.resolve(rootSSLDirPath, "cert.pem")
const cwdKeyPath = path.resolve(cwdSSLDirPath, "privkey.pem")
const cwdCertPath = path.resolve(cwdSSLDirPath, "cert.pem")
if (fs.existsSync(rootKeyPath) && fs.existsSync(rootCertPath)) {
process.env.GATEWAY_SSL_KEY = rootKeyPath
process.env.GATEWAY_SSL_CERT = rootCertPath
} else if (fs.existsSync(cwdKeyPath) && fs.existsSync(cwdCertPath)) {
process.env.GATEWAY_SSL_KEY = cwdKeyPath
process.env.GATEWAY_SSL_CERT = cwdCertPath
}
}
new Gateway().initialize()