mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	support listening on unix sockets
This commit is contained in:
		| @@ -6,7 +6,7 @@ const dataDir = require('./data_dir'); | |||||||
| function parseAndValidate(portStr, source) { | function parseAndValidate(portStr, source) { | ||||||
|     const portNum = parseInt(portStr); |     const portNum = parseInt(portStr); | ||||||
|  |  | ||||||
|     if (!portNum || portNum < 0 || portNum >= 65536) { |     if (!portNum && portNum !== 0 || portNum < 0 || portNum >= 65536) { | ||||||
|         console.log(`FATAL ERROR: Invalid port value "${portStr}" from ${source}, should be a number between 0 and 65536.`); |         console.log(`FATAL ERROR: Invalid port value "${portStr}" from ${source}, should be a number between 0 and 65536.`); | ||||||
|         process.exit(-1); |         process.exit(-1); | ||||||
|     } |     } | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								src/www
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								src/www
									
									
									
									
									
								
							| @@ -100,7 +100,11 @@ async function startTrilium() { | |||||||
|      */ |      */ | ||||||
|  |  | ||||||
|     httpServer.keepAliveTimeout = 120000 * 5; |     httpServer.keepAliveTimeout = 120000 * 5; | ||||||
|     httpServer.listen(port, host); |     if (port !== 0) { | ||||||
|  |       httpServer.listen(port, host); // TCP socket. | ||||||
|  |     } else { | ||||||
|  |       httpServer.listen(host); // Unix socket. | ||||||
|  |     } | ||||||
|     httpServer.on('error', error => { |     httpServer.on('error', error => { | ||||||
|             if (error.syscall !== 'listen') { |             if (error.syscall !== 'listen') { | ||||||
|                 throw error; |                 throw error; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user