mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:19:48 +00:00
Allow port and host override in Observatory
R=rmacnak@google.com Review-Url: https://codereview.chromium.org/3009013002 .
This commit is contained in:
parent
e61f6e72ee
commit
4ea98fba56
|
@ -107,12 +107,20 @@ class TargetRepository implements M.TargetRepository {
|
|||
}
|
||||
|
||||
static String _networkAddressOfDefaultTarget() {
|
||||
if (!identical(1, 1.0)) {
|
||||
// Dartium, assume we are developing.
|
||||
return 'ws://127.0.0.1:8181/ws';
|
||||
}
|
||||
Uri serverAddress = Uri.parse(window.location.toString());
|
||||
return 'ws://${serverAddress.authority}${serverAddress.path}ws';
|
||||
// It is possible to override the default port and host by adding extra
|
||||
// query parameters:
|
||||
// http://localhost:8080?override-port=8181
|
||||
// http://localhost:8080?override-port=8181&override-host=10.0.0.2
|
||||
final Uri serverAddress = Uri.parse(window.location.toString());
|
||||
final String port = serverAddress.queryParameters['override-port'];
|
||||
final String host = serverAddress.queryParameters['override-host'];
|
||||
final Uri wsAddress = new Uri(
|
||||
scheme: 'ws',
|
||||
host: host ?? serverAddress.host,
|
||||
port: int.parse(port ?? '', onError: (_) => null),
|
||||
path: '/ws',
|
||||
);
|
||||
return wsAddress.toString();
|
||||
}
|
||||
|
||||
bool isConnectedVMTarget(M.Target target) => _isConnectedVMTarget(target);
|
||||
|
|
Loading…
Reference in a new issue