Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 42b0275

Browse files
committed
fix: dynamically require the serve module
Requiring a `JWT_TOKEN` env var at the top level of that module was causing the Docker image build to fail (amongst other things).
1 parent 7c5517d commit 42b0275

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/cli.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import yaml from 'js-yaml'
1818

1919
import * as nix from './nix'
2020
import Environment, { SessionParameters, Platform } from './Environment'
21-
import serve from './serve'
2221

2322
const VERSION = require('../package').version
2423

@@ -444,7 +443,12 @@ yargs
444443
})
445444
outputOptions(yargs)
446445
}, async (argv: any) => {
447-
const { port, address } = serve(argv.port, argv.address)
446+
// We dynamically require the serve module because that does
447+
// a lot of setup stuff (e.g. checking for tokens, setting routes)
448+
// at the top level which we don't want to run unless we're actually serving.
449+
// That will be refactored in the future so it's all wrapped in functions.
450+
const serve = require('./serve')
451+
const { port, address } = serve.serve(argv.port, argv.address)
448452
output({ port, address }, argv, result => `⚡ Listening on http://${address}:${port}`)
449453
})
450454

0 commit comments

Comments
 (0)