67 lines
1.9 KiB
TypeScript
67 lines
1.9 KiB
TypeScript
import * as mediaserver from "./server";
|
|
import * as db from "./database";
|
|
import * as api from "./api";
|
|
import * as http from "./http";
|
|
import * as cleanup from "./cleanup";
|
|
import * as config from "config";
|
|
|
|
async function run() {
|
|
const dbcfg: object = config.database;
|
|
const bcryptcfg: object = config.bcrypt;
|
|
const satyr: object = {
|
|
privateEndpoint: config.media.privateEndpoint,
|
|
publicEndpoint: config.media.publicEndpoint,
|
|
record: config.media.record,
|
|
registration: config.satyr.registration,
|
|
webFormat: config.satyr.webFormat,
|
|
restrictedNames: config.satyr.restrictedNames,
|
|
name: config.satyr.name,
|
|
domain: config.satyr.domain,
|
|
email: config.satyr.email,
|
|
rootredirect: config.satyr.rootredirect,
|
|
version: process.env.npm_package_version,
|
|
directory: config.server.http.directory,
|
|
ffmpeg: config.media.ffmpeg
|
|
};
|
|
const nms: object = {
|
|
logType: config.server.logs,
|
|
rtmp: {
|
|
port: config.server.rtmp.port,
|
|
chunk_size: config.server.rtmp.chunk_size,
|
|
gop_cache: config.server.rtmp.gop_cache,
|
|
ping: config.server.rtmp.ping,
|
|
ping_timeout: config.server.rtmp.ping_timeout,
|
|
},
|
|
/*http: {
|
|
port: config.server.http.port + 1,
|
|
mediaroot: config.server.http.directory,
|
|
allow_origin: config.server.http.allow_origin
|
|
},
|
|
trans: {
|
|
ffmpeg: config.media.ffmpeg,
|
|
tasks: [
|
|
{
|
|
app: config.media.publicEndpoint,
|
|
hls: config.transcode.hls,
|
|
hlsFlags: config.transcode.hlsFlags,
|
|
dash: config.transcode.dash,
|
|
dashFlags: config.transcode.dashFlags
|
|
}
|
|
]
|
|
},*/
|
|
auth: {
|
|
api: config.server.api,
|
|
api_user: config.server.api_user,
|
|
api_pass: config.server.api_pass
|
|
}
|
|
|
|
};
|
|
db.init(dbcfg, bcryptcfg);
|
|
await cleanup.init();
|
|
api.init(satyr);
|
|
http.init(satyr, config.server.http.port, config.ircd);
|
|
mediaserver.init(nms, satyr);
|
|
console.log(`Satyr v${process.env.npm_package_version} ready`);
|
|
}
|
|
run();
|
|
export { run }; |