1
- import fs from "fs" ;
2
-
3
- import { config } from "./interfaces"
4
-
5
- const config = JSON . parse ( fs . readFileSync ( "./config.json" , "utf8" ) ) ;
6
-
7
- const maxPlayers = process . env . MAX_PLAYERS || config . maxPlayers
8
-
9
- /**
10
- * This exports a default object that contains the configuration for the server.
11
- * The object contains the following properties:
12
- * - name: the name of the server, taken from the environment variable SERVER_NAME or the config file.
13
- * - authServer: the URL of the authentication server, taken from the environment variable AUTH_SERVER or the config file.
14
- * - publicAddr: the public address of the server, taken from the environment variable PUBLIC_ADDRESS or the config file.
15
- * - maxPlayers: the maximum number of players allowed on the server, taken from the environment variable MAX_PLAYERS or the config file.
16
- * - external: an object containing the following properties:
17
- * - port: the port number for external connections, taken from the environment variable EXTERNAL_PORT or the config file.
18
- * - internal: an object containing the following properties:
19
- * - host: the host name for internal connections, taken from the environment variable INTERNAL_HOST or the config file.
20
- * - port: the port number for internal connections, taken from the environment variable INTERNAL_PORT or the config file.
21
- */
22
- export default {
23
- name : process . env . SERVER_NAME || config . name ,
24
- authServer : process . env . AUTH_SERVER || config . authServer ,
25
- publicAddr : process . env . PUBLIC_ADDRESS || config . publicAddr ,
26
- maxPlayers : typeof maxPlayers != "number" ? parseInt ( maxPlayers ) : maxPlayers ,
27
- external : {
28
- port : process . env . EXTERNAL_PORT || config . external . port ,
29
- } ,
30
- internal : {
31
- host : process . env . INTERNAL_HOST || config . internal . host ,
32
- port : process . env . INTERNAL_PORT || config . internal . port ,
33
- } ,
1
+ import fs from "fs" ;
2
+
3
+ import { config } from "./interfaces"
4
+
5
+ const config = JSON . parse ( fs . readFileSync ( "./config.json" , "utf8" ) ) ;
6
+
7
+ const maxPlayers = process . env . MAX_PLAYERS || config . maxPlayers
8
+
9
+ /**
10
+ * This exports a default object that contains the configuration for the server.
11
+ * The object contains the following properties:
12
+ * - name: the name of the server, taken from the environment variable SERVER_NAME or the config file.
13
+ * - authServer: the URL of the authentication server, taken from the environment variable AUTH_SERVER or the config file.
14
+ * - publicAddr: the public address of the server, taken from the environment variable PUBLIC_ADDRESS or the config file.
15
+ * - maxPlayers: the maximum number of players allowed on the server, taken from the environment variable MAX_PLAYERS or the config file.
16
+ * - external: an object containing the following properties:
17
+ * - port: the port number for external connections, taken from the environment variable EXTERNAL_PORT or the config file.
18
+ * - internal: an object containing the following properties:
19
+ * - host: the host name for internal connections, taken from the environment variable INTERNAL_HOST or the config file.
20
+ * - port: the port number for internal connections, taken from the environment variable INTERNAL_PORT or the config file.
21
+ */
22
+ export default {
23
+ name : process . env . SERVER_NAME || config . name ,
24
+ authServer : process . env . AUTH_SERVER || config . authServer ,
25
+ publicAddr : process . env . PUBLIC_ADDRESS || config . publicAddr ,
26
+ maxPlayers : typeof maxPlayers != "number" ? parseInt ( maxPlayers ) : maxPlayers ,
27
+ external : {
28
+ port : process . env . EXTERNAL_PORT || config . external . port ,
29
+ } ,
30
+ internal : {
31
+ host : process . env . INTERNAL_HOST || config . internal . host ,
32
+ port : process . env . INTERNAL_PORT || config . internal . port ,
33
+ } ,
34
+ redis : {
35
+ host : process . env . REDIS_HOST || config . redis . host ,
36
+ port : process . env . REDIS_PORT || config . redis . port ,
37
+ password : process . env . REDIS_PASSWORD || config . redis . password || undefined ,
38
+ } ,
34
39
} as config
0 commit comments