|
|
|
@ -2,10 +2,24 @@ import { getgid, getuid, setgid, setuid } from 'process'; |
|
|
|
|
|
|
|
|
|
import { PGID, PUID, PORT, ECODE_DROP_PRIVILEGES } from './lib/consts'; |
|
|
|
|
|
|
|
|
|
import app from './app'; |
|
|
|
|
import { proxyServerVncUpgrade } from './middlewares'; |
|
|
|
|
import { access } from './lib/accessModule'; |
|
|
|
|
import { stderr, stdout } from './lib/shell'; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Wait until the anvil-access-module daemon finishes its setup before doing |
|
|
|
|
* anything else. |
|
|
|
|
* |
|
|
|
|
* Notes: |
|
|
|
|
* * The webpackMode directive tells webpack to include the dynamic module into
|
|
|
|
|
* the main bundle. Webpack defaults to put such modules in separate files to |
|
|
|
|
* reduce the amount of loading. |
|
|
|
|
*/ |
|
|
|
|
access.once('active', async () => { |
|
|
|
|
const { default: app } = await import(/* webpackMode: "eager" */ './app'); |
|
|
|
|
const { proxyServerVncUpgrade } = await import( |
|
|
|
|
/* webpackMode: "eager" */ './middlewares' |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
(async () => { |
|
|
|
|
stdout(`Starting main process with ownership ${getuid()}:${getgid()}`); |
|
|
|
|
|
|
|
|
@ -27,3 +41,4 @@ import { stderr, stdout } from './lib/shell'; |
|
|
|
|
|
|
|
|
|
server.on('upgrade', proxyServerVncUpgrade); |
|
|
|
|
})(); |
|
|
|
|
}); |
|
|
|
|