mirror of
https://github.com/appwrite/appwrite
synced 2026-05-22 16:38:32 +00:00
chore: remove endpoint selector for edge
This commit is contained in:
parent
e267283fa9
commit
3d9e22a6df
1 changed files with 9 additions and 25 deletions
|
|
@ -21,19 +21,12 @@ class Executor
|
|||
|
||||
private bool $selfSigned = false;
|
||||
|
||||
/**
|
||||
* @var callable(string, string): string $endpoint
|
||||
*/
|
||||
private $endpointSelector;
|
||||
|
||||
private string $endpoint;
|
||||
protected array $headers;
|
||||
|
||||
/**
|
||||
* @param callable(string, string): string $endpointSelector
|
||||
*/
|
||||
public function __construct(callable $endpointSelector)
|
||||
public function __construct()
|
||||
{
|
||||
$this->endpointSelector = $endpointSelector;
|
||||
$this->endpoint = System::getEnv('_APP_EXECUTOR_HOST', '');
|
||||
$this->headers = [
|
||||
'content-type' => 'application/json',
|
||||
'authorization' => 'Bearer ' . System::getEnv('_APP_EXECUTOR_SECRET', ''),
|
||||
|
|
@ -97,8 +90,8 @@ class Executor
|
|||
'outputDirectory' => $outputDirectory
|
||||
];
|
||||
|
||||
$endpoint = $this->selectEndpoint($projectId, $deploymentId);
|
||||
$response = $this->call($endpoint, self::METHOD_POST, $route, [ 'x-opr-runtime-id' => $runtimeId ], $params, true, $timeout);
|
||||
|
||||
$response = $this->call($this->endpoint, self::METHOD_POST, $route, [ 'x-opr-runtime-id' => $runtimeId ], $params, true, $timeout);
|
||||
|
||||
$status = $response['headers']['status-code'];
|
||||
if ($status >= 400) {
|
||||
|
|
@ -128,8 +121,7 @@ class Executor
|
|||
'timeout' => $timeout
|
||||
];
|
||||
|
||||
$endpoint = $this->selectEndpoint($projectId, $deploymentId);
|
||||
$this->call($endpoint, self::METHOD_GET, $route, [ 'x-opr-runtime-id' => $runtimeId ], $params, true, $timeout, $callback);
|
||||
$this->call($this->endpoint, self::METHOD_GET, $route, [ 'x-opr-runtime-id' => $runtimeId ], $params, true, $timeout, $callback);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -145,8 +137,7 @@ class Executor
|
|||
$runtimeId = "$projectId-$deploymentId" . $suffix;
|
||||
$route = "/runtimes/$runtimeId";
|
||||
|
||||
$endpoint = $this->selectEndpoint($projectId, $deploymentId);
|
||||
$response = $this->call($endpoint, self::METHOD_DELETE, $route, [
|
||||
$response = $this->call($this->endpoint, self::METHOD_DELETE, $route, [
|
||||
'x-opr-addressing-method' => 'broadcast'
|
||||
], [], true, 30);
|
||||
|
||||
|
|
@ -239,8 +230,7 @@ class Executor
|
|||
$requestTimeout = $timeout + 15;
|
||||
}
|
||||
|
||||
$endpoint = $this->selectEndpoint($projectId, $deploymentId);
|
||||
$response = $this->call($endpoint, self::METHOD_POST, $route, [ 'x-opr-runtime-id' => $runtimeId, 'content-type' => 'multipart/form-data', 'accept' => 'multipart/form-data' ], $params, true, $requestTimeout);
|
||||
$response = $this->call($this->endpoint, self::METHOD_POST, $route, [ 'x-opr-runtime-id' => $runtimeId, 'content-type' => 'multipart/form-data', 'accept' => 'multipart/form-data' ], $params, true, $requestTimeout);
|
||||
|
||||
$status = $response['headers']['status-code'];
|
||||
if ($status >= 400) {
|
||||
|
|
@ -274,8 +264,7 @@ class Executor
|
|||
'timeout' => $timeout
|
||||
];
|
||||
|
||||
$endpoint = $this->selectEndpoint($projectId, $deploymentId);
|
||||
$response = $this->call($endpoint, self::METHOD_POST, $route, [ 'x-opr-runtime-id' => $runtimeId ], $params, true, $timeout);
|
||||
$response = $this->call($this->endpoint, self::METHOD_POST, $route, [ 'x-opr-runtime-id' => $runtimeId ], $params, true, $timeout);
|
||||
|
||||
$status = $response['headers']['status-code'];
|
||||
if ($status >= 400) {
|
||||
|
|
@ -465,9 +454,4 @@ class Executor
|
|||
|
||||
return $output;
|
||||
}
|
||||
|
||||
private function selectEndpoint(string $projectId, string $deploymentId): string
|
||||
{
|
||||
return call_user_func($this->endpointSelector, $projectId, $deploymentId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue