Skip to content

Commit

Permalink
fix: corrected listenAddress being overwritten;
Browse files Browse the repository at this point in the history
  • Loading branch information
ncoonrod committed Mar 8, 2025
1 parent 667d73c commit 7abcd3f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hotstaq",
"version": "0.8.115",
"version": "0.8.116",
"description": "A friendly web framework that fits nicely into devops and CI/CD pipelines.",
"bin": {
"hotstaq": "./bin/hotstaq"
Expand Down
12 changes: 9 additions & 3 deletions src/HotHTTPServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1410,10 +1410,12 @@ export class HotHTTPServer extends HotServer
port = this.ports.https;
}

if (this.listenAddress === "0.0.0.0")
this.listenAddress = "localhost";
let listenStr = this.listenAddress;

const baseUrl = `${protocol}://${this.listenAddress}:${port}/`;
if (listenStr === "0.0.0.0")
listenStr = "localhost";

const baseUrl = `${protocol}://${listenStr}:${port}/`;

if (this.swaggerUI.jsonObj.servers == null)
this.swaggerUI.jsonObj.servers = [];
Expand Down Expand Up @@ -1603,6 +1605,8 @@ export class HotHTTPServer extends HotServer
if (this.ssl.cert === "")
{
this.httpListener = http.createServer (this.expressApp);

this.logger.info (`HTTP Listening on address: ${this.listenAddress}`);
this.httpListener.listen (this.ports.http, this.listenAddress, completedSetup);

process.on ('SIGTERM', sigHandler.bind (this, "SIGTERM", "HTTP", this.httpListener));
Expand All @@ -1621,6 +1625,7 @@ export class HotHTTPServer extends HotServer
});
res.end ();
});
this.logger.info (`HTTP Listening on address: ${this.listenAddress}`);
this.httpListener.listen (this.ports.http, this.listenAddress, () =>
{
this.logger.info (`Redirecting HTTP(${this.ports.http}) traffic to HTTPS(${this.ports.https})`);
Expand All @@ -1644,6 +1649,7 @@ export class HotHTTPServer extends HotServer
key: this.ssl.key,
ca: this.ssl.ca
}, this.expressApp);
this.logger.info (`HTTPS Listening on address: ${this.listenAddress}`);
this.httpsListener.listen (this.ports.https, this.listenAddress, completedSetup);

process.on ('SIGTERM', sigHandler.bind (this, "SIGTERM", "HTTPS", this.httpsListener));
Expand Down
2 changes: 1 addition & 1 deletion src/HotStaq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export class HotStaq implements IHotStaq
/**
* The current version of HotStaq.
*/
static version: string = "0.8.115";
static version: string = "0.8.116";
/**
* Indicates if this is a web build.
*/
Expand Down

0 comments on commit 7abcd3f

Please sign in to comment.