Inline many variables.
This commit is contained in:
@@ -21,7 +21,7 @@ function invalidTokenResponse()
|
||||
function serializeApiResponse($data)
|
||||
{
|
||||
if ($data instanceof Collection) {
|
||||
$data = $data->map(function ($d) {
|
||||
return $data->map(function ($d) {
|
||||
$d = collect($d)->sortKeys();
|
||||
$created_at = data_get($d, 'created_at');
|
||||
$updated_at = data_get($d, 'updated_at');
|
||||
@@ -49,8 +49,6 @@ function serializeApiResponse($data)
|
||||
|
||||
return $d;
|
||||
});
|
||||
|
||||
return $data;
|
||||
} else {
|
||||
$d = collect($data)->sortKeys();
|
||||
$created_at = data_get($d, 'created_at');
|
||||
|
||||
@@ -32,9 +32,8 @@ function getCurrentApplicationContainerStatus(Server $server, int $id, ?int $pul
|
||||
|
||||
return null;
|
||||
});
|
||||
$containers = $containers->filter();
|
||||
|
||||
return $containers;
|
||||
return $containers->filter();
|
||||
}
|
||||
|
||||
return $containers;
|
||||
@@ -46,9 +45,8 @@ function getCurrentServiceContainerStatus(Server $server, int $id): Collection
|
||||
if (! $server->isSwarm()) {
|
||||
$containers = instant_remote_process(["docker ps -a --filter='label=coolify.serviceId={$id}' --format '{{json .}}' "], $server);
|
||||
$containers = format_docker_command_output_to_json($containers);
|
||||
$containers = $containers->filter();
|
||||
|
||||
return $containers;
|
||||
return $containers->filter();
|
||||
}
|
||||
|
||||
return $containers;
|
||||
|
||||
@@ -43,14 +43,13 @@ function generate_github_jwt_token(GithubApp $source)
|
||||
$tokenBuilder = (new Builder(new JoseEncoder, ChainedFormatter::default()));
|
||||
$now = CarbonImmutable::now();
|
||||
$now = $now->setTime($now->format('H'), $now->format('i'));
|
||||
$issuedToken = $tokenBuilder
|
||||
|
||||
return $tokenBuilder
|
||||
->issuedBy($source->app_id)
|
||||
->issuedAt($now->modify('-1 minute'))
|
||||
->expiresAt($now->modify('+10 minutes'))
|
||||
->getToken($algorithm, $signingKey)
|
||||
->toString();
|
||||
|
||||
return $issuedToken;
|
||||
}
|
||||
|
||||
function githubApi(GithubApp|GitlabApp|null $source, string $endpoint, string $method = 'get', ?array $data = null, bool $throwError = true)
|
||||
|
||||
@@ -16,11 +16,10 @@ function collectProxyDockerNetworksByServer(Server $server)
|
||||
return collect();
|
||||
}
|
||||
$networks = instant_remote_process(['docker inspect --format="{{json .NetworkSettings.Networks }}" coolify-proxy'], $server, false);
|
||||
$networks = collect($networks)->map(function ($network) {
|
||||
|
||||
return collect($networks)->map(function ($network) {
|
||||
return collect(json_decode($network))->keys();
|
||||
})->flatten()->unique();
|
||||
|
||||
return $networks;
|
||||
}
|
||||
function collectDockerNetworksByServer(Server $server)
|
||||
{
|
||||
|
||||
@@ -245,8 +245,5 @@ function updateCompose(ServiceApplication|ServiceDatabase $resource)
|
||||
}
|
||||
function serviceKeys()
|
||||
{
|
||||
$services = get_service_templates();
|
||||
$serviceKeys = $services->keys();
|
||||
|
||||
return $serviceKeys;
|
||||
return get_service_templates()->keys();
|
||||
}
|
||||
|
||||
@@ -501,9 +501,8 @@ function generateFqdn(Server $server, string $random, bool $forceHttps = false):
|
||||
if ($forceHttps) {
|
||||
$scheme = 'https';
|
||||
}
|
||||
$finalFqdn = "$scheme://{$random}.$host$path";
|
||||
|
||||
return $finalFqdn;
|
||||
return "$scheme://{$random}.$host$path";
|
||||
}
|
||||
function sslip(Server $server)
|
||||
{
|
||||
@@ -653,9 +652,8 @@ function generateTagDeployWebhook($tag_name)
|
||||
$baseUrl = base_url();
|
||||
$api = Url::fromString($baseUrl).'/api/v1';
|
||||
$endpoint = "/deploy?tag=$tag_name";
|
||||
$url = $api.$endpoint;
|
||||
|
||||
return $url;
|
||||
return $api.$endpoint;
|
||||
}
|
||||
function generateDeployWebhook($resource)
|
||||
{
|
||||
@@ -663,9 +661,8 @@ function generateDeployWebhook($resource)
|
||||
$api = Url::fromString($baseUrl).'/api/v1';
|
||||
$endpoint = '/deploy';
|
||||
$uuid = data_get($resource, 'uuid');
|
||||
$url = $api.$endpoint."?uuid=$uuid&force=false";
|
||||
|
||||
return $url;
|
||||
return $api.$endpoint."?uuid=$uuid&force=false";
|
||||
}
|
||||
function generateGitManualWebhook($resource, $type)
|
||||
{
|
||||
@@ -674,9 +671,8 @@ function generateGitManualWebhook($resource, $type)
|
||||
}
|
||||
if ($resource->getMorphClass() === \App\Models\Application::class) {
|
||||
$baseUrl = base_url();
|
||||
$api = Url::fromString($baseUrl)."/webhooks/source/$type/events/manual";
|
||||
|
||||
return $api;
|
||||
return Url::fromString($baseUrl)."/webhooks/source/$type/events/manual";
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -55,12 +55,11 @@ function getStripeCustomerPortalSession(Team $team)
|
||||
if (! $stripe_customer_id) {
|
||||
return null;
|
||||
}
|
||||
$session = \Stripe\BillingPortal\Session::create([
|
||||
|
||||
return \Stripe\BillingPortal\Session::create([
|
||||
'customer' => $stripe_customer_id,
|
||||
'return_url' => $return_url,
|
||||
]);
|
||||
|
||||
return $session;
|
||||
}
|
||||
function allowedPathsForUnsubscribedAccounts()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user