aboutsummaryrefslogtreecommitdiffstats
path: root/testing/grafana-image-renderer/10-host-param.patch
blob: b4d3b7abbc149ac80e9cb7fb091a22cdca6960ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
https://github.com/grafana/grafana-image-renderer/pull/40

diff --git a/src/app.ts b/src/app.ts
index fffcd3d..b5b58f6 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -22,7 +22,7 @@ async function main() {
 
     const logger = new ConsoleLogger();
     const browser = new Browser(logger);
-    const server = new HttpServer({port: argv.port}, logger, browser);
+    const server = new HttpServer({port: argv.port, host: argv.host}, logger, browser);
 
     server.start();
 
diff --git a/src/http-server.ts b/src/http-server.ts
index 1aa875d..018bf6c 100644
--- a/src/http-server.ts
+++ b/src/http-server.ts
@@ -26,8 +26,9 @@ export class HttpServer {
       return res.status(err.output.statusCode).json(err.output.payload);
     });
 
-    this.app.listen(this.options.port);
-    this.log.info(`HTTP Server started, listening on ${this.options.port}`);
+    this.app.listen(this.options.port, this.options.host);
+    const hostlabel = this.options.host ? this.options.host : '';
+    this.log.info(`HTTP Server started, listening on ${hostlabel}:${this.options.port}`);
   }
 
   render = async (req: express.Request, res: express.Response) => {