mirror of
https://github.com/Ryujinx/Ryujinx-Ldn-Website.git
synced 2025-08-11 20:41:11 +00:00
Add SOCKET_PATH env var and prefer it over HOST and PORT
This commit is contained in:
parent
65b14e7c8a
commit
5fd2354286
|
@ -23,6 +23,7 @@ This app can be configured using the following environment variables:
|
|||
| Name | Description | Default value | Notes |
|
||||
| :------------- | ----------------------------------------------------------------------------------------- | :-----------: | ---------------------------------------------------------------------- |
|
||||
| `NODE_ENV` | This should be set to `production` or `development` depending on the current environment. | `""` | |
|
||||
| `SOCKET_PATH` | The path to the unix socket this server should be listening on. | `""` | If this is not empty `HOST` and `PORT` will be ignored. |
|
||||
| `HOST` | The address this server should be listening on. | `"127.0.0.1"` | |
|
||||
| `PORT` | The port this server should be using. | `3000` | |
|
||||
| `REDIS_URL` | The URL of the redis server. | `""` | Format: `redis[s]://[[username][:password]@][host][:port][/db-number]` |
|
||||
|
|
|
@ -3,7 +3,13 @@ import { app, logger } from "./app";
|
|||
import http from "http";
|
||||
|
||||
const server = http.createServer(app);
|
||||
server.listen(parseInt(env.PORT || "3000"), env.HOST || "127.0.0.1");
|
||||
|
||||
if (process.env.SOCKET_PATH != null && process.env.SOCKET_PATH.length > 0) {
|
||||
server.listen(process.env.SOCKET_PATH);
|
||||
}
|
||||
else {
|
||||
server.listen(parseInt(env.PORT || "3000"), env.HOST || "127.0.0.1");
|
||||
}
|
||||
|
||||
server.on("error", (error: Error) => {
|
||||
logger.error("An error occurred.", error);
|
||||
|
|
Loading…
Reference in a new issue