Bypass certificates on bypass auth

This commit is contained in:
Kyle Carberry 2019-02-28 16:06:17 -06:00
parent 8327da8d00
commit 94edbd59e9
No known key found for this signature in database
GPG Key ID: A0409BDB6B0B3EDB
1 changed files with 5 additions and 1 deletions

View File

@ -77,6 +77,10 @@ export const createApp = async (options: CreateAppOptions): Promise<{
};
const isEncrypted = (socket: net.Socket): boolean => {
if (options.bypassAuth) {
return true;
}
// tslint:disable-next-line:no-any
return (socket as any).encrypted;
};
@ -125,7 +129,7 @@ export const createApp = async (options: CreateAppOptions): Promise<{
});
});
const server = httpolyglot.createServer(options.httpsOptions || certs, app) as http.Server;
const server = httpolyglot.createServer(options.bypassAuth ? {} : options.httpsOptions || certs, app) as http.Server;
const wss = new ws.Server({ server });
wss.shouldHandle = (req): boolean => {