File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed
packages/amplify-appsync-simulator Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 44
44
"graphql" : " ^15.5.0" ,
45
45
"graphql-iso-date" : " ^3.6.1" ,
46
46
"graphql-subscriptions" : " ^1.1.0" ,
47
- "ip" : " ^1.1.9" ,
48
47
"js-string-escape" : " ^1.0.1" ,
49
48
"jwt-decode" : " ^2.2.0" ,
50
49
"libphonenumber-js" : " 1.9.47" ,
Original file line number Diff line number Diff line change @@ -5,14 +5,25 @@ import { Server, createServer } from 'http';
5
5
import { createServer as createHttpsServer } from 'https' ;
6
6
import { readFileSync } from 'fs' ;
7
7
import { fromEvent } from 'promise-toolbox' ;
8
- import { address as getLocalIpAddress } from 'ip' ;
9
8
import { AppSyncSimulatorSubscriptionServer } from './websocket-subscription' ;
10
9
import getPort from 'get-port' ;
11
10
import { REALTIME_SUBSCRIPTION_PATH } from './subscription/websocket-server/server' ;
11
+ import os from 'os' ;
12
12
13
13
const BASE_PORT = 8900 ;
14
14
const MAX_PORT = 9999 ;
15
15
16
+ function getLocalIpAddress ( ) : string {
17
+ const interfaces = os . networkInterfaces ( ) ;
18
+ const internalAddresses = Object . keys ( interfaces )
19
+ . map ( ( nic ) => {
20
+ const addresses = interfaces [ nic ] . filter ( ( details ) => details . internal ) ;
21
+ return addresses . length ? addresses [ 0 ] . address : undefined ;
22
+ } )
23
+ . filter ( Boolean ) ;
24
+ return internalAddresses . length ? internalAddresses [ 0 ] : '127.0.0.1' ;
25
+ }
26
+
16
27
export class AppSyncSimulatorServer {
17
28
private _operationServer : OperationServer ;
18
29
private _httpServer : Server ;
Original file line number Diff line number Diff line change @@ -123,7 +123,6 @@ __metadata:
123
123
graphql: ^15.5.0
124
124
graphql-iso-date: ^3.6.1
125
125
graphql-subscriptions: ^1.1.0
126
- ip: ^1.1.9
127
126
jose: ^5.2.0
128
127
js-string-escape: ^1.0.1
129
128
jwt-decode: ^2.2.0
@@ -21603,7 +21602,7 @@ __metadata:
21603
21602
languageName: node
21604
21603
linkType: hard
21605
21604
21606
- "ip@npm:^1.1.8, ip@npm:^1.1.9 ":
21605
+ "ip@npm:^1.1.8":
21607
21606
version: 1.1.9
21608
21607
resolution: "ip@npm:1.1.9"
21609
21608
checksum: 5af58bfe2110c9978acfd77a2ffcdf9d33a6ce1c72f49edbaf16958f7a8eb979b5163e43bb18938caf3aaa55cdacde4e470874c58ca3b4b112ea7a30461a0c27
You can’t perform that action at this time.
0 commit comments