Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ Notably the path to the site configs must be a readable directory to the PHP pro
The local site provider works be reading php-based config files from a given directory. This reads all sites recognized by the `vnla docker` setup. For a site config to be recognized it must meet the following criteria

- The file has name matching one of the following patterns
- `/*.php` - Becomes `*.vanilla.localhost`
- `/vanilla.localhost/*.php` - Becomes `vanilla.localhost/*`
- `/e2e-tests.vanilla.localhost/*.php` - Becomes `e2e-tests.vanilla.localhost/*`
- `/*.php` - Becomes `*.vanilla.local`
- `/vanilla.local/*.php` - Becomes `vanilla.local/*`
- `/e2e-tests.vanilla.local/*.php` - Becomes `e2e-tests.vanilla.local/*`
- The file contains a valid PHP configuration files.
- The configuration contains the following values
- `Vanilla.SiteID`
Expand Down
12 changes: 6 additions & 6 deletions src/Local/LocalSiteProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,18 +180,18 @@ private function domainForConfigPath(string $configPath): ?string
{
$configPath = str_replace($this->siteConfigFsBasePath, "", $configPath);
if (preg_match("/^\\/config.php$/", $configPath)) {
return "http://dev.vanilla.localhost";
} elseif (preg_match("/^\\/vanilla\.localhost\\/(.*)\\.php$/", $configPath, $matches)) {
return "http://dev.vanilla.local";
} elseif (preg_match("/^\\/vanilla\.local\\/(.*)\\.php$/", $configPath, $matches)) {
$nodeName = $matches[1];

return "http://vanilla.localhost/$nodeName";
} elseif (preg_match("/^\\/e2e-tests\.vanilla\.localhost\\/(.*)\\.php$/", $configPath, $matches)) {
return "http://vanilla.local/$nodeName";
} elseif (preg_match("/^\\/e2e-tests\.vanilla\.local\\/(.*)\\.php$/", $configPath, $matches)) {
$siteName = $matches[1];

return "http://e2e-tests.vanilla.localhost/$siteName";
return "http://e2e-tests.vanilla.local/$siteName";
} elseif (preg_match("/^\\/([^\/]+)\.php$/", $configPath, $matches)) {
$siteName = $matches[1];
return "http://{$siteName}.vanilla.localhost";
return "http://{$siteName}.vanilla.local";
}

return null;
Expand Down
2 changes: 1 addition & 1 deletion src/Site.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public function getQueueServiceBaseUrl(): string

switch ($this->getCluster()->getRegionID()) {
case Cluster::REGION_LOCALHOST:
return "http://queue.vanilla.localhost";
return "http://queue.vanilla.local";
case Cluster::REGION_YUL1_DEV1:
return "https://yul1-vanillaqueue-dev1.v-fabric.net";
case Cluster::REGION_YUL1_PROD1:
Expand Down
2 changes: 1 addition & 1 deletion tests/DashboardSitesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected function setUp(): void
*/
public function siteProvider(): DashboardSiteProvider
{
$baseUrl = "https://dashboard.vanilla.localhost";
$baseUrl = "https://dashboard.vanilla.local";
$dashboardClient = new DashboardHttpClient($baseUrl, "tokenhere");
if ($this->mockHandler === null) {
$this->fail("Mock handler wasn't configured");
Expand Down
22 changes: 11 additions & 11 deletions tests/LocalSitesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ private function expectedSites(): array
self::SID_CFG_PHP,
100,
"cl00000",
"http://dev.vanilla.localhost",
"http://dev.vanilla.local",
$commonConfig,
),
self::SID_VALID => new ExpectedSite(
self::SID_VALID,
101,
"cl00000",
"http://vanilla.localhost/valid",
"http://vanilla.local/valid",
$commonConfig + [
"SomeArr" => [3, 4, 5],
"ClusterConfig.SomeKey" => "cluster1",
Expand All @@ -59,21 +59,21 @@ private function expectedSites(): array
self::SID_NO_SYS_TOKEN,
101,
"cl00000",
"http://vanilla.localhost/no-system-token",
"http://vanilla.local/no-system-token",
$commonConfig,
))->expectNoSystemToken(),
self::SID_E2E => new ExpectedSite(
self::SID_E2E,
102,
"cl00000",
"http://e2e-tests.vanilla.localhost/site1",
"http://e2e-tests.vanilla.local/site1",
$commonConfig,
),
self::SID_OTHER_CLUSTER => new ExpectedSite(
self::SID_OTHER_CLUSTER,
105,
"cl00001",
"http://other-cluster.vanilla.localhost",
"http://other-cluster.vanilla.local",
$commonConfig + [
"ClusterConfig.SomeKey" => "cluster2",
],
Expand All @@ -82,17 +82,17 @@ private function expectedSites(): array
self::SID_HUB,
10000,
"cl00000",
"http://vanilla.localhost/hub",
"http://vanilla.local/hub",
$commonConfig + [],
294952213, // crc32(vanilla.localhost)
3913469086, // crc32(vanilla.local)
),
self::SID_NODE1 => new ExpectedSite(
self::SID_NODE1,
10000,
"cl00000",
"http://vanilla.localhost/node1",
"http://vanilla.local/node1",
$commonConfig + [],
294952213, // crc32(vanilla.localhost)
3913469086, // crc32(vanilla.local)
),
];
}
Expand Down Expand Up @@ -166,9 +166,9 @@ public function testSerializeSite(): void
$expected = <<<JSON
{
"siteID": 101,
"baseUrl": "http:\/\/vanilla.localhost\/valid",
"baseUrl": "http:\/\/vanilla.local\/valid",
"clusterID": "cl00000",
"configPath": "\/vanilla.localhost\/valid.php"
"configPath": "\/vanilla.local\/valid.php"
}
JSON;

Expand Down
4 changes: 2 additions & 2 deletions tests/OrchClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ class OrchClientTest extends TestCase
*/
public function testForcedIpAddress()
{
$client = new OrchHttpClient("https://orch.vanilla.localhost", "secret");
$client = new OrchHttpClient("https://orch.vanilla.local", "secret");
$client->setHandler(new MockHttpHandler());
$client->setThrowExceptions(false);
$client->forceIpAddress("12.34.56.78");

$request = $client->get("/hello")->getRequest();
$this->assertEquals("https://12.34.56.78/hello", $request->getUrl());
$this->assertEquals("orch.vanilla.localhost", $request->getHeader("Host"));
$this->assertEquals("orch.vanilla.local", $request->getHeader("Host"));
}
}
2 changes: 1 addition & 1 deletion tests/OrchSitesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected function setUp(): void
*/
public function siteProvider(): OrchSiteProvider
{
$baseUrl = "https://orch.vanilla.localhost";
$baseUrl = "https://orch.vanilla.local";
$orchClient = new OrchHttpClient($baseUrl, "tokenhere");
if ($this->mockHandler === null) {
$this->fail("Mock handler wasn't configured");
Expand Down
2 changes: 1 addition & 1 deletion tests/mock-orch/cluster/all.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"endpoint": "cluster/all",
"method": "GET",
"provider": {
"name": "orch.vanilla.localhost",
"name": "orch.vanilla.local",
"address": "0.0.0.0",
"version": "0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/mock-orch/site/all.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"endpoint": "site/all",
"method": "GET",
"provider": {
"name": "orch.vanilla.localhost",
"name": "orch.vanilla.local",
"address": "0.0.0.0",
"version": "0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/mock-orch/site/context/get/?siteid=100.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"endpoint": "site/context/get",
"method": "GET",
"provider": {
"name": "orch.vanilla.localhost",
"name": "orch.vanilla.local",
"address": "0.0.0.0",
"version": "0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/mock-orch/site/context/get/?siteid=4000001.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"endpoint": "site/context/get",
"method": "GET",
"provider": {
"name": "orch.vanilla.localhost",
"name": "orch.vanilla.local",
"address": "0.0.0.0",
"version": "0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/mock-orch/site/context/get/?siteid=4000002.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"endpoint": "site/context/get",
"method": "GET",
"provider": {
"name": "orch.vanilla.localhost",
"name": "orch.vanilla.local",
"address": "0.0.0.0",
"version": "0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/mock-orch/site/context/get/?siteid=4000003.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"endpoint": "site/context/get",
"method": "GET",
"provider": {
"name": "orch.vanilla.localhost",
"name": "orch.vanilla.local",
"address": "0.0.0.0",
"version": "0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/mock-orch/site/context/get/?siteid=4000004.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"endpoint": "site/context/get",
"method": "GET",
"provider": {
"name": "orch.vanilla.localhost",
"name": "orch.vanilla.local",
"address": "0.0.0.0",
"version": "0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/mock-orch/site/context/get/?siteid=4000005.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"endpoint": "site/context/get",
"method": "GET",
"provider": {
"name": "orch.vanilla.localhost",
"name": "orch.vanilla.local",
"address": "0.0.0.0",
"version": "0.0"
},
Expand Down