Implement account authentication (server)

This commit is contained in:
Elijah R
2024-04-05 09:10:47 -04:00
committed by Elijah R
parent b815bf8874
commit f89492cfcd
6 changed files with 133 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ import * as fs from "fs";
import WSServer from './WSServer.js';
import QEMUVM from './QEMUVM.js';
import log from './log.js';
import AuthManager from './AuthManager.js';
log("INFO", "CollabVM Server starting up");
@@ -34,12 +35,15 @@ async function start() {
log("WARN", "To remove this warning, use the qmpHost and qmpPort options instead.");
}
// Init the auth manager if enabled
var auth = Config.auth.enabled ? new AuthManager(Config.auth.apiEndpoint, Config.auth.secretKey) : null;
// Fire up the VM
var VM = new QEMUVM(Config);
await VM.Start();
// Start up the websocket server
var WS = new WSServer(Config, VM);
var WS = new WSServer(Config, VM, auth);
WS.listen();
}
start();