Skip to content
This repository was archived by the owner on Apr 27, 2021. It is now read-only.

Commit f4e5ee9

Browse files
qbootjoelwurtz
authored andcommitted
Add consistency between proxies
1 parent 5933e79 commit f4e5ee9

File tree

5 files changed

+9
-19
lines changed

5 files changed

+9
-19
lines changed

Tests/RedirectionIOTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ class RedirectionIOTest extends TestCase
6464
'connections' => [
6565
[
6666
'name' => 'agent',
67-
'host' => 'localhost',
68-
'port' => 3100,
67+
'remote_socket' => 'tcp://localhost:3100',
6968
],
7069
],
7170
'doNotRedirectAdmin' => false,
@@ -134,8 +133,7 @@ public function testWhenAgentDown()
134133
'connections' => [
135134
[
136135
'name' => 'agent',
137-
'host' => 'unknown-host',
138-
'port' => 80,
136+
'remote_socket' => 'tcp://unknown-host:80',
139137
],
140138
],
141139
'doNotRedirectAdmin' => false,

assets/js/redirectionio.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function rioAddConnection(e)
2222
var id = parseInt(lastInput.name.split(/\[|\]/)[3]);
2323
var newId = id + 1;
2424

25-
// clone a table of inputs (name, host and port)
25+
// clone a table of inputs (name, remote_address)
2626
var clone = tables[0].cloneNode(true);
2727
var cloneInputs = clone.getElementsByTagName('input');
2828

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
}
1919
],
2020
"require": {
21-
"redirectionio/proxy-sdk": "^1.0"
21+
"redirectionio/proxy-sdk": "^0.1"
2222
},
2323
"require-dev": {
2424
"friendsofphp/php-cs-fixer": "^2.10",
@@ -40,7 +40,7 @@
4040
},
4141
"extra": {
4242
"branch-alias": {
43-
"dev-master": "1.0.x-dev"
43+
"dev-master": "1.x-dev"
4444
}
4545
}
4646
}

src/RedirectionIO.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,8 @@ public function findRedirect()
4040
return false;
4141
}
4242

43-
foreach ($options['connections'] as $option) {
44-
foreach ($option as $key => $val) {
45-
if ($key === 'name') {
46-
continue;
47-
}
48-
49-
$connections[$option['name']][$key] = $val;
50-
}
43+
foreach ($options['connections'] as $connection) {
44+
$connections[$connection['name']] = $connection['remote_socket'];
5145
}
5246

5347
$client = new Client($connections);

src/RedirectionIOSettingsPage.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ public function registerSettings()
112112
case 'remote_socket':
113113
$title = __('Agent address', 'redirectionio');
114114
$required = true;
115-
$description = __('[Required] Insert here your agent address. Internet Domain socket (AF_INET) and Unix Domain socket (AF_UNIX) are supported.<br/> Examples: 192.168.1.1:20301, agent.my-website.com:10301, /var/run/my-agent.sock', 'redirectionio');
116-
$placeholder = '192.168.1.1:20301';
115+
$description = __('[Required] Insert here your agent address. Internet Domain socket (AF_INET) and Unix Domain socket (AF_UNIX) are supported.<br/> Examples: tcp://192.168.1.1:20301, tcp://agent.my-website.com:10301, unix:///var/run/my-agent.sock', 'redirectionio');
116+
$placeholder = 'tcp://192.168.1.1:20301';
117117
break;
118118
default:
119119
$title = 'unknown';
@@ -247,8 +247,6 @@ public static function isWorkingConnection($connection)
247247

248248
$client = new Client(
249249
['checkStatus' => [
250-
'host' => $connection['host'],
251-
'port' => $connection['port'],
252250
'remote_socket' => $connection['remote_socket'],
253251
]],
254252
10000,

0 commit comments

Comments
 (0)