forked from facebook/docusaurus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(facebook#10769) Add workaround for microsoft/vscode-remote-releas…
…e#7029 by using IPv4 loopback when in Remote Container environment
- Loading branch information
1 parent
ff5be65
commit 36cc19c
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import logger from '@docusaurus/logger'; | ||
|
||
export function forceV4OnRemoteContainers( | ||
userCLIConfig: OptionallyProvidedHost, | ||
): void { | ||
if (process.env.REMOTE_CONTAINERS === 'true') { | ||
if (!userCLIConfig.host) { | ||
userCLIConfig.host = '127.0.0.1'; | ||
logger.info( | ||
'Will default to binding to IPv4 local address to better support VSCode Remote port forwarding', | ||
); | ||
} else { | ||
logger.warn('VSCode Remote may not support IPv6'); | ||
} | ||
} | ||
} | ||
|
||
export type OptionallyProvidedHost = { | ||
host?: string; | ||
}; |