Skip to content

best way to save what you love

api: always create separate server for itunnels

jjf06aa6580104
diff --git a/api/src/core/api.js b/api/src/core/api.js
index 76a0f95f..e19e0674 100644
--- a/api/src/core/api.js
+++ b/api/src/core/api.js
@@ -316,8 +316,6 @@ export const runAPI = async (express, app, __dirname, isPrimary = true) => {
return stream(res, { type: 'internal', ...streamInfo });
};
- app.get('/itunnel', itunnelHandler);
-
app.get('/', (_, res) => {
res.type('json');
res.status(200).send(serverInfo);
@@ -378,17 +376,15 @@ export const runAPI = async (express, app, __dirname, isPrimary = true) => {
}
});
- if (isCluster) {
- const istreamer = express();
- istreamer.get('/itunnel', itunnelHandler);
- const server = istreamer.listen({
- port: 0,
- host: '127.0.0.1',
- exclusive: true
- }, () => {
- const { port } = server.address();
- console.log(`${Green('[✓]')} cobalt sub-instance running on 127.0.0.1:${port}`);
- setTunnelPort(port);
- });
- }
+ const istreamer = express();
+ istreamer.get('/itunnel', itunnelHandler);
+ const server = istreamer.listen({
+ port: 0,
+ host: '127.0.0.1',
+ exclusive: true
+ }, () => {
+ const { port } = server.address();
+ console.log(`${Green('[✓]')} cobalt sub-instance running on 127.0.0.1:${port}`);
+ setTunnelPort(port);
+ });
}