add ability to specify hostname to bind on

master
Drake 2 years ago
parent 42d2f2fca9
commit 0067905feb

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

@ -15,7 +15,7 @@ export class GoofyAhhException extends Error {
} }
await initDB(); await initDB();
if (config.websocket.enabled) initSocket(config.websocket.port); if (config.websocket.enabled) initSocket(config.websocket.hostname, config.websocket.port);
initOnMessage(); initOnMessage();
initLocalCommands(); initLocalCommands();
initCommands(); 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"; import config from "./config.ts";
interface SockClient { interface SockClient {
@ -59,8 +59,8 @@ function reqHandler(req: Request) {
return response; return response;
} }
export default function initialize(port: number) { export default function initialize(hostname: string, port: number) {
serve(reqHandler, { port: port }); serve(reqHandler, { hostname: hostname, port: port });
} }
export function sendSocketMessage( export function sendSocketMessage(

Loading…
Cancel
Save