File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ export function merge(input) {
5353 appendServerDirectoryOption ,
5454 handleProxyOption ,
5555 handlePortsOption ,
56+ handleHostOption ,
5657 handleGhostModeOption ,
5758 handleFilesOption ,
5859 handleExtensionsOption ,
Original file line number Diff line number Diff line change 1+ import { BsTempOptions , TransformResult } from "../cli-options" ;
2+ import { BsErrorLevels , BsErrorTypes } from "../../bin" ;
3+
4+ export function handleHostOption ( incoming : BsTempOptions ) : TransformResult {
5+ const host : string | null = incoming . get ( "host" ) ;
6+ const listen : string | null = incoming . get ( "listen" ) ;
7+
8+ if ( host && listen ) {
9+ if ( host !== listen ) {
10+ return [ incoming , [ {
11+ errors : [
12+ {
13+ error : new Error ( "Cannot specify both `host` and `listen` options" ) ,
14+ meta ( ) {
15+ return [
16+ "" ,
17+ "Tip: Use just the `listen` option *only* if you want to bind only to a particular host." ,
18+ ]
19+ }
20+ }
21+ ] ,
22+ level : BsErrorLevels . Fatal ,
23+ type : BsErrorTypes . HostAndListenIncompatible
24+ } ] ] ;
25+ }
26+
27+ // whenever we have have both `host` + `listen` options,
28+ // we remove the 'host' to prevent complication further down the line
29+ return [
30+ incoming . delete ( 'host' ) ,
31+ [ ] ] ;
32+ }
33+
34+ return [ incoming , [ ] ] ;
35+ }
You can’t perform that action at this time.
0 commit comments