Skip to content

Commit 5061949

Browse files
committed
added host arg
1 parent 2f00678 commit 5061949

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

Procfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
web: php bin/server.php --no-io --port=$PORT
1+
web: php bin/server.php --no-io --port=$PORT --host=0.0.0.0

bin/server.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
$noFsIO = false;
1111
$port = 15155;
12+
$host = 'localhost';
1213

1314
foreach($argv AS $arg){
1415
if($arg === '--no-io'){
@@ -19,6 +20,9 @@
1920
if($name === '--port'){
2021
$port = $value;
2122
}
23+
elseif($name === '--host'){
24+
$host = $value;
25+
}
2226
}
2327
}
2428

@@ -54,8 +58,8 @@
5458

5559
$http->on('request', $handler);
5660

57-
$socket->listen($port);
61+
$socket->listen($port, $host);
5862

59-
echo "Started http server on {$port}\n";
63+
echo "Started http server on {$host}:{$port}\n";
6064

6165
$loop->run();

0 commit comments

Comments
 (0)