mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 02:24:16 +00:00
25 lines
878 B
JavaScript
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()
|