mirror of
https://github.com/Ryujinx/Ryujinx-Ldn-Website.git
synced 2025-08-11 14:21:13 +00:00
Add DATA_PATH env var
This commit is contained in:
parent
5a270a0eab
commit
be3e724868
17
README.md
17
README.md
|
@ -20,14 +20,15 @@
|
||||||
|
|
||||||
This app can be configured using the following environment variables:
|
This app can be configured using the following environment variables:
|
||||||
|
|
||||||
| Name | Description | Default value | Notes |
|
| Name | Description | Default value | Notes |
|
||||||
| :------------- | ----------------------------------------------------------------------------------------- | :-----------: | ---------------------------------------------------------------------- |
|
| :------------- | ----------------------------------------------------------------------------------------- | :-----------: | ------------------------------------------------------------------------------------------------------------ |
|
||||||
| `NODE_ENV` | This should be set to `production` or `development` depending on the current environment. | `""` | |
|
| `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. |
|
| `DATA_PATH` | The path to the data directory of this server. | `"data"` | This can either be a relative path or an absolute path. Currently this directory only contains the log file. |
|
||||||
| `HOST` | The address this server should be listening on. | `"127.0.0.1"` | |
|
| `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. |
|
||||||
| `PORT` | The port this server should be using. | `3000` | |
|
| `HOST` | The address this server should be listening on. | `"127.0.0.1"` | |
|
||||||
| `REDIS_URL` | The URL of the redis server. | `""` | Format: `redis[s]://[[username][:password]@][host][:port][/db-number]` |
|
| `PORT` | The port this server should be using. | `3000` | |
|
||||||
| `REDIS_SOCKET` | The path to the unix socket of the redis server. | `""` | If this is not empty `REDIS_URL` will be ignored. |
|
| `REDIS_URL` | The URL of the redis server. | `""` | Format: `redis[s]://[[username][:password]@][host][:port][/db-number]` |
|
||||||
|
| `REDIS_SOCKET` | The path to the unix socket of the redis server. | `""` | If this is not empty `REDIS_URL` will be ignored. |
|
||||||
|
|
||||||
## Contribute
|
## Contribute
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,11 @@ import {
|
||||||
import winston from "winston";
|
import winston from "winston";
|
||||||
import apiRouter from "./api";
|
import apiRouter from "./api";
|
||||||
import { errorLogger, requestLogger } from "./middleware";
|
import { errorLogger, requestLogger } from "./middleware";
|
||||||
|
import { mkdirSync } from "fs";
|
||||||
|
|
||||||
|
// Prepare data directory
|
||||||
|
const dataDirectory = process.env.DATA_PATH ?? "data";
|
||||||
|
mkdirSync(dataDirectory, { recursive: true });
|
||||||
|
|
||||||
// Init logger
|
// Init logger
|
||||||
const loggerInstance = winston.createLogger({
|
const loggerInstance = winston.createLogger({
|
||||||
|
@ -17,7 +22,7 @@ const loggerInstance = winston.createLogger({
|
||||||
transports: [
|
transports: [
|
||||||
new winston.transports.Console(),
|
new winston.transports.Console(),
|
||||||
new winston.transports.File({
|
new winston.transports.File({
|
||||||
filename: `data/ryujinx-ldn-website.log`,
|
filename: `${dataDirectory}/ryujinx-ldn-website.log`,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,7 +5,11 @@ import http from "http";
|
||||||
const server = http.createServer(app);
|
const server = http.createServer(app);
|
||||||
|
|
||||||
if (process.env.SOCKET_PATH != null && process.env.SOCKET_PATH.length > 0) {
|
if (process.env.SOCKET_PATH != null && process.env.SOCKET_PATH.length > 0) {
|
||||||
server.listen(process.env.SOCKET_PATH);
|
server.listen({
|
||||||
|
path: process.env.SOCKET_PATH,
|
||||||
|
readableAll: true,
|
||||||
|
writableAll: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
server.listen(parseInt(env.PORT || "3000"), env.HOST || "127.0.0.1");
|
server.listen(parseInt(env.PORT || "3000"), env.HOST || "127.0.0.1");
|
||||||
|
|
Loading…
Reference in a new issue