Allow the user to specify hostname to listen on (#138)

This commit is contained in:
Jouni K. Seppänen
2022-12-04 06:24:06 +01:00
committed by GitHub
parent 8c62ca981e
commit 9baac2181a
5 changed files with 15 additions and 7 deletions
+4 -2
View File
@@ -5,11 +5,12 @@ import { AssetBundle, AssetJson } from "../plugos/asset_bundle/bundle.ts";
export function serveCommand(options: any, folder: string) {
const pagesPath = path.resolve(Deno.cwd(), folder);
const hostname = options.hostname || "0.0.0.0";
const port = options.port || 3000;
console.log(
"Going to start Silver Bullet on port",
port,
"Going to start Silver Bullet on",
`${hostname}:${port}`,
"serving pages from",
pagesPath,
"with db file",
@@ -17,6 +18,7 @@ export function serveCommand(options: any, folder: string) {
);
const httpServer = new HttpServer({
hostname,
port: port,
pagesPath: pagesPath,
dbPath: path.join(pagesPath, options.db),