Get rid of many useless blank lines

This commit is contained in:
Lucas Michot 2024-10-31 17:44:01 +01:00
parent a6b560a649
commit 8e1444eaa7
72 changed files with 0 additions and 103 deletions

View file

@ -39,7 +39,6 @@ class RunRemoteProcess
*/
public function __construct(Activity $activity, bool $hide_from_output = false, bool $ignore_errors = false, $call_event_on_finish = null, $call_event_data = null)
{
if ($activity->getExtraProperty('type') !== ActivityTypes::INLINE->value && $activity->getExtraProperty('type') !== ActivityTypes::COMMAND->value) {
throw new \RuntimeException('Incompatible Activity to run a remote command.');
}

View file

@ -70,6 +70,5 @@ public function handle(Server $server, bool $async = true, bool $force = false):
return 'OK';
}
}
}

View file

@ -50,7 +50,6 @@ public function handle(Server $server, string $cloudflare_token)
'rm -fr /tmp/cloudflared',
]);
instant_remote_process($commands, $server);
}
}
}

View file

@ -64,6 +64,5 @@ public function handle()
if ($this->option('yes')) {
$webhooks->delete();
}
}
}

View file

@ -26,6 +26,5 @@ public function handle()
collect($queueOverlaps)->each(function ($key) {
Redis::connection()->del($key);
});
}
}

View file

@ -36,7 +36,6 @@ public function handle()
private function cleanup_stucked_resources()
{
try {
$servers = Server::all()->filter(function ($server) {
return $server->isFunctional();

View file

@ -73,7 +73,6 @@ public function handle()
}
}
}
} catch (\Exception $e) {
$this->error($e->getMessage());
@ -95,6 +94,5 @@ private function disableServers(Team $team)
]);
}
}
}
}

View file

@ -25,7 +25,6 @@ public function handle()
return;
}
}
public function generateOpenApi()

View file

@ -32,7 +32,6 @@ public function handle()
$this->servers = Server::all();
if (isCloud()) {
} else {
$this->send_alive_signal();
get_public_ips();
@ -120,7 +119,6 @@ private function cleanup_unnecessary_dynamic_proxy_configuration()
} catch (\Throwable $e) {
echo "Error in cleaning up unnecessary dynamic proxy configuration: {$e->getMessage()}\n";
}
}
}

View file

@ -21,6 +21,5 @@ public function handle()
$error = preg_replace('/^\h*\v+/m', '', $error);
echo $error;
echo $process->output();
}
}

View file

@ -1213,7 +1213,6 @@ private function create_application(Request $request, $type)
}
return response()->json(['message' => 'Invalid type.'], 400);
}
#[OA\Get(
@ -1869,18 +1868,15 @@ public function update_env_by_uuid(Request $request)
return response()->json($this->removeSensitiveData($env))->setStatusCode(201);
} else {
return response()->json([
'message' => 'Environment variable not found.',
], 404);
}
}
return response()->json([
'message' => 'Something is not okay. Are you okay?',
], 500);
}
#[OA\Patch(
@ -2225,14 +2221,12 @@ public function create_env(Request $request)
return response()->json([
'uuid' => $env->uuid,
])->setStatusCode(201);
}
}
return response()->json([
'message' => 'Something went wrong.',
], 500);
}
#[OA\Delete(
@ -2580,7 +2574,6 @@ public function action_restart(Request $request)
'deployment_uuid' => $deployment_uuid->toString(),
],
);
}
#[OA\Post(
@ -2746,7 +2739,6 @@ private function validateDataApplications(Request $request, Server $server)
'custom_labels' => 'The custom_labels should be base64 encoded.',
],
], 422);
}
}
if ($request->has('domains') && $server->isProxyShouldRun()) {

View file

@ -471,7 +471,6 @@ public function update_by_uuid(Request $request)
$request->offsetSet('mysql_conf', $mysqlConf);
}
break;
}
$extraFields = array_diff(array_keys($request->all()), $allowedFields);
if ($validator->fails() || ! empty($extraFields)) {
@ -506,7 +505,6 @@ public function update_by_uuid(Request $request)
return response()->json([
'message' => 'Database updated.',
]);
}
#[OA\Post(
@ -1165,7 +1163,6 @@ public function create_database(Request $request, NewDatabaseTypes $type)
}
return response()->json(serializeApiResponse($payload))->setStatusCode(201);
} elseif ($type === NewDatabaseTypes::MARIADB) {
$allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'mariadb_conf', 'mariadb_root_password', 'mariadb_user', 'mariadb_password', 'mariadb_database'];
$validator = customApiValidator($request->all(), [
@ -1826,6 +1823,5 @@ public function action_restart(Request $request)
],
200
);
}
}

View file

@ -356,7 +356,6 @@ public function update_project(Request $request)
'name' => $project->name,
'description' => $project->description,
])->setStatusCode(201);
}
#[OA\Delete(

View file

@ -1238,6 +1238,5 @@ public function action_restart(Request $request)
],
200
);
}
}

View file

@ -174,7 +174,6 @@ public function manual(Request $request)
'pull_request_html_url' => $pull_request_html_url,
]);
}
}
queue_application_deployment(
application: $application,

View file

@ -31,7 +31,6 @@ public function handle(): void
$settings->update(['helper_version' => $latest_version]);
}
}
} catch (\Throwable $e) {
send_internal_notification('CheckHelperImageJob failed with: '.$e->getMessage());
throw $e;

View file

@ -129,7 +129,6 @@ public function handle(): void
if ($this->postgres_password) {
$this->postgres_password = str($this->postgres_password)->after('POSTGRES_PASSWORD=')->value();
}
} elseif (str($databaseType)->contains('mysql')) {
$this->container_name = "{$this->database->name}-$serviceUuid";
$this->directory_name = $serviceName.'-'.$this->container_name;

View file

@ -167,7 +167,6 @@ public function handle()
$this->foundServiceDatabaseIds->push($subId);
$this->updateServiceSubStatus($serviceId, $subType, $subId, $containerStatus);
}
} else {
$uuid = $labels->get('com.docker.compose.service');
$type = $labels->get('coolify.type');
@ -265,7 +264,6 @@ private function updateProxyStatus()
instant_remote_process($connectProxyToDockerNetworks, $this->server, false);
}
}
}
private function updateDatabaseStatus(string $databaseUuid, string $containerStatus, bool $tcpProxy = false)

View file

@ -68,7 +68,6 @@ private function getServerTimezone(): string
public function handle(): void
{
try {
$this->task_log = ScheduledTaskExecution::create([
'scheduled_task_id' => $this->task->id,

View file

@ -94,11 +94,9 @@ public function handle()
}
}
}
} catch (\Throwable $e) {
return handleError($e);
}
}
private function checkLogDrainContainer()

View file

@ -33,10 +33,8 @@ public function handle()
return 'Server is not reachable or not ready.';
}
SshMultiplexingHelper::removeMuxFile($this->server);
} catch (\Throwable $e) {
return handleError($e);
}
}
}

View file

@ -58,10 +58,8 @@ function () use ($team, $serverDiskUsageNotificationThreshold) {
} else {
RateLimiter::hit('high-disk-usage:'.$this->server->id, 600);
}
} catch (\Throwable $e) {
return handleError($e);
}
}
}

View file

@ -41,7 +41,6 @@ public function handle(): void
$settings->update(['new_version_available' => false]);
Log::info('Coolify update completed successfully.');
} catch (\Throwable $e) {
Log::error('UpdateCoolifyJob failed: '.$e->getMessage());
// Consider implementing a notification to administrators

View file

@ -88,7 +88,6 @@ public function getContainers()
public function runImport()
{
if ($this->filename === '') {
$this->dispatch('error', 'Please select a file to import.');

View file

@ -51,7 +51,6 @@ public function mount()
$this->db_url = $this->database->internal_db_url;
$this->db_url_public = $this->database->external_db_url;
$this->server = data_get($this->database, 'destination.server');
}
public function instantSaveAdvanced()

View file

@ -57,7 +57,6 @@ public function mount()
$this->db_url = $this->database->internal_db_url;
$this->db_url_public = $this->database->external_db_url;
$this->server = data_get($this->database, 'destination.server');
}
public function instantSaveAdvanced()

View file

@ -55,7 +55,6 @@ public function mount()
$this->db_url = $this->database->internal_db_url;
$this->db_url_public = $this->database->external_db_url;
$this->server = data_get($this->database, 'destination.server');
}
public function instantSaveAdvanced()

View file

@ -99,7 +99,6 @@ public function updatedBaseDirectory()
$this->base_directory = '/'.$this->base_directory;
}
}
}
public function updatedDockerComposeLocation()

View file

@ -100,7 +100,6 @@ public function mount()
'is_preview' => false,
]);
}
});
}
$service->parse(isNew: true);

View file

@ -48,7 +48,6 @@ public function mount()
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
public function generateDockerCompose()

View file

@ -132,7 +132,6 @@ public function loadContainers()
}
});
}
}
if ($this->containers->count() > 0) {
$this->container = $this->containers->first();
@ -155,7 +154,6 @@ public function connectToServer()
data_get($this->server, 'name'),
data_get($this->server, 'uuid')
);
} catch (\Throwable $e) {
return handleError($e, $this);
}
@ -185,7 +183,6 @@ public function connectToContainer()
data_get($container, 'container.Names'),
data_get($container, 'server.uuid')
);
} catch (\Throwable $e) {
return handleError($e, $this);
}

View file

@ -109,9 +109,7 @@ public function mount()
$this->containers = $this->containers->filter(function ($container) {
return str_contains($container, $this->query['pull_request_id']);
});
}
} catch (\Exception $e) {
return handleError($e, $this);
}

View file

@ -147,7 +147,6 @@ public function cloneTo($destination_id)
return redirect()->to($route);
}
}
public function moveTo($environment_id)

View file

@ -100,7 +100,6 @@ public function submitFileStorage()
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
public function submitFileStorageDirectory()
@ -127,7 +126,6 @@ public function submitFileStorageDirectory()
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
public function submitPersistentVolume()
@ -144,7 +142,6 @@ public function submitPersistentVolume()
'mount_path' => $this->mount_path,
'host_path' => $this->host_path,
]);
} catch (\Throwable $e) {
return handleError($e, $this);
}

View file

@ -26,7 +26,6 @@ public function closeTerminal()
#[On('send-terminal-command')]
public function sendTerminalCommand($isContainer, $identifier, $serverUuid)
{
$server = Server::ownedByCurrentTeam()->whereUuid($serverUuid)->firstOrFail();
if ($isContainer) {

View file

@ -37,7 +37,6 @@ public function uploadConfig()
return;
}
}
public function render()

View file

@ -49,7 +49,6 @@ public function loadData()
$this->dispatch("refreshChartData-{$this->chartId}-memory", [
'seriesData' => $memoryMetrics,
]);
} catch (\Throwable $e) {
return handleError($e, $this);
}

View file

@ -86,7 +86,6 @@ public function mount(Server $server)
$this->server = $server;
$this->timezones = collect(timezone_identifiers_list())->sort()->values()->toArray();
$this->wildcard_domain = $this->server->settings->wildcard_domain;
}
public function checkSyncStatus()
@ -169,7 +168,6 @@ public function updatedServerSettingsIsSentinelDebugEnabled()
public function instantSave()
{
try {
$this->validate();
refresh_server_connection($this->server->privateKey);
$this->validateServer(false);

View file

@ -51,7 +51,6 @@ public function mount(string $server_uuid)
public function syncData(bool $toModel = false)
{
if ($toModel) {
$this->validate();
$this->server->settings->is_logdrain_newrelic_enabled = $this->isLogDrainNewRelicEnabled;
@ -78,7 +77,6 @@ public function syncData(bool $toModel = false)
$this->logDrainCustomConfig = $this->server->settings->logdrain_custom_config;
$this->logDrainCustomConfigParser = $this->server->settings->logdrain_custom_config_parser;
}
}
public function instantSave()

View file

@ -99,7 +99,6 @@ public function loadProxyConfiguration()
} else {
$this->dispatch('traefikDashboardAvailable', false);
}
} catch (\Throwable $e) {
return handleError($e, $this);
}

View file

@ -47,7 +47,6 @@ public function mount()
} else {
return redirect()->route('dashboard');
}
}
public function submitFromFields()

View file

@ -140,7 +140,6 @@ public function mount()
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
public function submit()

View file

@ -23,11 +23,9 @@ public function checkUpdate()
try {
$this->latestVersion = get_latest_version_of_coolify();
$this->isUpgradeAvailable = data_get(InstanceSettings::get(), 'new_version_available', false);
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
public function upgrade()

View file

@ -15,7 +15,6 @@ public function again()
$this->rateLimit(1, 300);
auth()->user()->sendVerificationEmail();
$this->dispatch('success', 'Email verification link sent!');
} catch (\Exception $e) {
return handleError($e, $this);
}

View file

@ -29,7 +29,6 @@ protected static function booted()
foreach ($shared_variables as $shared_variable) {
$shared_variable->delete();
}
});
}

View file

@ -162,7 +162,6 @@ private function get_real_environment_variables(?string $environment_variable =
$environment_variable = trim($environment_variable);
$sharedEnvsFound = str($environment_variable)->matchAll('/{{(.*?)}}/');
if ($sharedEnvsFound->isEmpty()) {
return $environment_variable;
}

View file

@ -36,7 +36,6 @@ protected static function booted(): void
});
}
});
}
public function fqdn(): Attribute

View file

@ -72,7 +72,6 @@ public function deleteStorageOnServer()
if ($path && $path != '/' && $path != '.' && $path != '..') {
if ($isFile === 'OK') {
$commands->push("rm -rf $path > /dev/null 2>&1 || true");
} elseif ($isDir === 'OK') {
$commands->push("rm -rf $path > /dev/null 2>&1 || true");
$commands->push("rmdir $path > /dev/null 2>&1 || true");

View file

@ -1095,7 +1095,6 @@ public function extraFields()
}
$fields->put('MariaDB', $data->toArray());
break;
}
}
@ -1304,7 +1303,6 @@ public function parse(bool $isNew = false): Collection
} else {
return collect([]);
}
}
public function networks()

View file

@ -30,7 +30,6 @@ public function __construct(public ScheduledTask $task, public string $output)
public function via(object $notifiable): array
{
return setNotificationChannels($notifiable, 'scheduled_tasks');
}

View file

@ -28,7 +28,6 @@ function serializeApiResponse($data)
if ($created_at) {
unset($d['created_at']);
$d['created_at'] = $created_at;
}
if ($updated_at) {
unset($d['updated_at']);
@ -59,7 +58,6 @@ function serializeApiResponse($data)
if ($created_at) {
unset($d['created_at']);
$d['created_at'] = $created_at;
}
if ($updated_at) {
unset($d['updated_at']);

View file

@ -581,7 +581,6 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
redirect_direction: $application->redirect
));
}
}
} else {
if (data_get($preview, 'fqdn')) {
@ -633,7 +632,6 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
is_stripprefix_enabled: $application->isStripprefixEnabled()
));
}
}
return $labels->all();

View file

@ -21,7 +21,6 @@ function collectProxyDockerNetworksByServer(Server $server)
})->flatten()->unique();
return $networks;
}
function collectDockerNetworksByServer(Server $server)
{

View file

@ -3188,7 +3188,6 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
'is_build_time' => false,
'is_preview' => false,
]);
} else {
$value = generateEnvValue($command, $resource);
$resource->environment_variables()->where('key', $key->value())->where($nameOfId, $resource->id)->firstOrCreate([
@ -3616,7 +3615,6 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
'is_required' => $isRequired,
]);
}
}
}
if ($isApplication) {
@ -3980,7 +3978,6 @@ function convertComposeEnvironmentToArray($environment)
}
return $convertedServiceVariables;
}
function instanceSettings()
{
@ -3989,7 +3986,6 @@ function instanceSettings()
function loadConfigFromGit(string $repository, string $branch, string $base_directory, int $server_id, int $team_id)
{
$server = Server::find($server_id)->where('team_id', $team_id)->first();
if (! $server) {
return;

View file

@ -13,7 +13,6 @@ public function up(): void
{
Schema::table('subscriptions', function (Blueprint $table) {
$table->string('stripe_plan_id')->nullable()->after('stripe_cancel_at_period_end');
});
}

View file

@ -14,7 +14,6 @@ public function up(): void
Schema::table('subscriptions', function (Blueprint $table) {
$table->string('stripe_feedback')->nullable()->after('stripe_cancel_at_period_end');
$table->string('stripe_comment')->nullable()->after('stripe_feedback');
});
}

View file

@ -13,7 +13,6 @@ public function up(): void
{
Schema::table('subscriptions', function (Blueprint $table) {
$table->boolean('stripe_trial_already_ended')->default(false)->after('stripe_cancel_at_period_end');
});
}

View file

@ -13,7 +13,6 @@ public function up(): void
{
Schema::table('team_invitations', function (Blueprint $table) {
$table->text('link')->change();
});
}

View file

@ -16,7 +16,6 @@ public function up(): void
$table->longText('description')->nullable();
$table->longText('docker_compose_raw');
$table->longText('docker_compose')->nullable();
});
}

View file

@ -13,7 +13,6 @@ public function up(): void
{
Schema::table('environment_variables', function (Blueprint $table) {
$table->foreignId('service_id')->nullable();
});
}

View file

@ -14,7 +14,6 @@ public function up(): void
Schema::table('services', function (Blueprint $table) {
$table->dropColumn('destination_type');
$table->dropColumn('destination_id');
});
}

View file

@ -26,6 +26,5 @@ public function down(): void
$table->dropColumn('unreachable_email_sent');
$table->integer('unreachable_count')->default(0);
});
}
};

View file

@ -22,7 +22,6 @@ public function up(): void
$table->boolean('is_logdrain_axiom_enabled')->default(false);
$table->string('logdrain_axiom_dataset_name')->nullable();
$table->string('logdrain_axiom_api_key')->nullable();
});
}

View file

@ -66,6 +66,5 @@ public function down(): void
Schema::table('service_databases', function (Blueprint $table) {
$table->dropSoftDeletes();
});
}
};

View file

@ -14,7 +14,6 @@ public function up(): void
Schema::table('applications', function (Blueprint $table) {
$table->string('docker_compose_custom_start_command')->nullable();
$table->string('docker_compose_custom_build_command')->nullable();
});
}

View file

@ -13,7 +13,6 @@ public function up(): void
{
Schema::table('applications', function (Blueprint $table) {
$table->text('custom_docker_run_options')->nullable()->change();
});
}

View file

@ -13,7 +13,6 @@ public function up(): void
{
Schema::table('application_settings', function (Blueprint $table) {
$table->boolean('connect_to_docker_network')->default(false);
});
}

View file

@ -13,7 +13,6 @@ public function up(): void
{
Schema::table('applications', function (Blueprint $table) {
$table->string('manual_webhook_secret_gitea')->nullable();
});
}

View file

@ -30,7 +30,6 @@ public function up()
$serverSetting->docker_cleanup_threshold = $serverSetting->cleanup_after_percentage;
$serverSetting->save();
}
}
/**

View file

@ -20,6 +20,5 @@ public function up()
echo 'Encrypting private keys failed.';
echo $e->getMessage();
}
}
}

View file

@ -126,7 +126,6 @@ public function run(): void
echo "Your localhost connection won't work until then.";
}
}
}
if (config('coolify.is_windows_docker_desktop')) {
PrivateKey::updateOrCreate(
@ -187,6 +186,5 @@ public function run(): void
$this->call(OauthSettingSeeder::class);
$this->call(PopulateSshKeysDirectorySeeder::class);
$this->call(SentinelSeeder::class);
}
}

View file

@ -128,7 +128,6 @@
Route::match(['get', 'post'], '/services/{uuid}/start', [ServicesController::class, 'action_deploy'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::match(['get', 'post'], '/services/{uuid}/restart', [ServicesController::class, 'action_restart'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::match(['get', 'post'], '/services/{uuid}/stop', [ServicesController::class, 'action_stop'])->middleware([IgnoreReadOnlyApiToken::class]);
});
Route::group([