mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 01:47:39 -07:00
✌️
This commit is contained in:
parent
7d5612b1a5
commit
ced8124276
3 changed files with 16 additions and 20 deletions
|
@ -16,14 +16,11 @@ secondary_url:
|
||||||
# 待受ポート
|
# 待受ポート
|
||||||
port:
|
port:
|
||||||
|
|
||||||
# TLSの設定
|
# TLSの設定(利用しない場合は省略可能)
|
||||||
https:
|
https:
|
||||||
# TLSを有効にするか否か
|
# 証明書のパス...
|
||||||
enable: false
|
key:
|
||||||
|
cert:
|
||||||
key: null
|
|
||||||
cert: null
|
|
||||||
ca: null
|
|
||||||
|
|
||||||
# MongoDBの設定
|
# MongoDBの設定
|
||||||
mongodb:
|
mongodb:
|
||||||
|
|
|
@ -38,12 +38,7 @@ type Source = {
|
||||||
url: string;
|
url: string;
|
||||||
secondary_url: string;
|
secondary_url: string;
|
||||||
port: number;
|
port: number;
|
||||||
https: {
|
https?: { [x: string]: string };
|
||||||
enable: boolean;
|
|
||||||
key: string;
|
|
||||||
cert: string;
|
|
||||||
ca: string;
|
|
||||||
};
|
|
||||||
mongodb: {
|
mongodb: {
|
||||||
host: string;
|
host: string;
|
||||||
port: number;
|
port: number;
|
||||||
|
|
|
@ -61,13 +61,17 @@ app.use(require('./web/server'));
|
||||||
/**
|
/**
|
||||||
* Create server
|
* Create server
|
||||||
*/
|
*/
|
||||||
const server = config.https.enable ?
|
const server = (() => {
|
||||||
https.createServer({
|
if (config.https) {
|
||||||
key: fs.readFileSync(config.https.key),
|
const certs = {};
|
||||||
cert: fs.readFileSync(config.https.cert),
|
Object.keys(config.https).forEach(k => {
|
||||||
ca: fs.readFileSync(config.https.ca)
|
certs[k] = fs.readFileSync(config.https[k]);
|
||||||
}, app) :
|
});
|
||||||
http.createServer(app);
|
return https.createServer(certs, app);
|
||||||
|
} else {
|
||||||
|
return http.createServer(app);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Steaming
|
* Steaming
|
||||||
|
|
Loading…
Reference in a new issue