Use production mode (#904)

* Set NODE_ENV to production

* Disable the X-Powered-By HTTP header

* Explain what the different values do

* Add changelog file
This commit is contained in:
davidegirardi 2024-02-27 15:35:03 +01:00 committed by GitHub
parent 6c6cd6ee92
commit 9a6d4317b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 1 deletions

View File

@ -45,6 +45,8 @@ COPY --from=builder /src/lib ./
COPY --from=builder /src/public ./public
COPY --from=builder /src/assets ./assets
ENV NODE_ENV="production"
VOLUME /data
EXPOSE 9993
EXPOSE 7775

1
changelog.d/904.misc Normal file
View File

@ -0,0 +1 @@
Switch expressjs to production mode for improved performance.

View File

@ -27,7 +27,12 @@ cd matrix-hookshot
yarn # or npm i
```
Starting the bridge (after configuring it), is a matter of running `yarn start`.
Starting the bridge (after configuring it), is a matter of setting the `NODE_ENV` environment variable to `production` or `development`, depending if you want [better performance or more verbose logging](https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production), and then running it:
```bash
NODE_ENV=production yarn start
```
## Installation via Docker

View File

@ -30,6 +30,7 @@ export class ListenerService {
}
for (const listenerConfig of config) {
const app = expressApp();
app.set('x-powered-by', false);
app.use(Handlers.requestHandler());
this.listeners.push({
config: listenerConfig,