add ability to specify hostname to bind on

master
Drake 2 years ago
parent 42d2f2fca9
commit 0067905feb

@ -14,6 +14,7 @@
"websocket": {
"enabled": true,
"debug": false,
"hostname": "localhost",
"port": 3012
},
"discord": {

@ -15,7 +15,7 @@ export class GoofyAhhException extends Error {
}
await initDB();
if (config.websocket.enabled) initSocket(config.websocket.port);
if (config.websocket.enabled) initSocket(config.websocket.hostname, config.websocket.port);
initOnMessage();
initLocalCommands();
initCommands();

@ -1,4 +1,4 @@
import { serve } from "https://deno.land/std@0.160.0/http/server.ts";
import { serve } from "https://deno.land/std@0.162.0/http/server.ts";
import config from "./config.ts";
interface SockClient {
@ -59,8 +59,8 @@ function reqHandler(req: Request) {
return response;
}
export default function initialize(port: number) {
serve(reqHandler, { port: port });
export default function initialize(hostname: string, port: number) {
serve(reqHandler, { hostname: hostname, port: port });
}
export function sendSocketMessage(

Loading…
Cancel
Save