Skip to content

Commit 40b1b25

Browse files
authored
feat(bazel): support PORT environment variable in http_server (#2724)
This will be useful for a more generic `server_test` rule.
1 parent b45dfa7 commit 40b1b25

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: bazel/http-server/main.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ const {rootPaths, historyApiFallback, enableDevUi, environmentVariables, port, r
1515
process.argv.slice(2),
1616
)
1717
.strict()
18-
.option('port', {type: 'number', default: 4200})
18+
.option('port', {
19+
type: 'number',
20+
default: process.env['PORT'] !== undefined ? Number(process.env['PORT']) : 4200,
21+
defaultDescription: '${PORT}, or 4200 if unset',
22+
})
1923
.option('historyApiFallback', {type: 'boolean', default: false})
2024
.option('rootPaths', {type: 'array', string: true, default: ['']})
2125
.option('environmentVariables', {type: 'array', string: true, default: []})

0 commit comments

Comments
 (0)