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 @@ class StartProxy
return 'OK';
}
}
}

View File

@@ -50,7 +50,6 @@ class ConfigureCloudflared
'rm -fr /tmp/cloudflared',
]);
instant_remote_process($commands, $server);
}
}
}

View File

@@ -64,6 +64,5 @@ class CleanupDatabase extends Command
if ($this->option('yes')) {
$webhooks->delete();
}
}
}

View File

@@ -26,6 +26,5 @@ class CleanupRedis extends Command
collect($queueOverlaps)->each(function ($key) {
Redis::connection()->del($key);
});
}
}

View File

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

View File

@@ -73,7 +73,6 @@ class CloudCleanupSubscriptions extends Command
}
}
}
} catch (\Exception $e) {
$this->error($e->getMessage());
@@ -95,6 +94,5 @@ class CloudCleanupSubscriptions extends Command
]);
}
}
}
}

View File

@@ -25,7 +25,6 @@ class Dev extends Command
return;
}
}
public function generateOpenApi()

View File

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

View File

@@ -21,6 +21,5 @@ class OpenApi extends Command
$error = preg_replace('/^\h*\v+/m', '', $error);
echo $error;
echo $process->output();
}
}

View File

@@ -1213,7 +1213,6 @@ class ApplicationsController extends Controller
}
return response()->json(['message' => 'Invalid type.'], 400);
}
#[OA\Get(
@@ -1869,18 +1868,15 @@ class ApplicationsController extends Controller
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 @@ class ApplicationsController extends Controller
return response()->json([
'uuid' => $env->uuid,
])->setStatusCode(201);
}
}
return response()->json([
'message' => 'Something went wrong.',
], 500);
}
#[OA\Delete(
@@ -2580,7 +2574,6 @@ class ApplicationsController extends Controller
'deployment_uuid' => $deployment_uuid->toString(),
],
);
}
#[OA\Post(
@@ -2746,7 +2739,6 @@ class ApplicationsController extends Controller
'custom_labels' => 'The custom_labels should be base64 encoded.',
],
], 422);
}
}
if ($request->has('domains') && $server->isProxyShouldRun()) {

View File

@@ -471,7 +471,6 @@ class DatabasesController extends Controller
$request->offsetSet('mysql_conf', $mysqlConf);
}
break;
}
$extraFields = array_diff(array_keys($request->all()), $allowedFields);
if ($validator->fails() || ! empty($extraFields)) {
@@ -506,7 +505,6 @@ class DatabasesController extends Controller
return response()->json([
'message' => 'Database updated.',
]);
}
#[OA\Post(
@@ -1165,7 +1163,6 @@ class DatabasesController extends Controller
}
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 @@ class DatabasesController extends Controller
],
200
);
}
}

View File

@@ -356,7 +356,6 @@ class ProjectController extends Controller
'name' => $project->name,
'description' => $project->description,
])->setStatusCode(201);
}
#[OA\Delete(

View File

@@ -1238,6 +1238,5 @@ class ServicesController extends Controller
],
200
);
}
}

View File

@@ -174,7 +174,6 @@ class Gitea extends Controller
'pull_request_html_url' => $pull_request_html_url,
]);
}
}
queue_application_deployment(
application: $application,

View File

@@ -31,7 +31,6 @@ class CheckHelperImageJob implements ShouldBeEncrypted, ShouldQueue
$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 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
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 @@ class PushServerUpdateJob implements ShouldBeEncrypted, ShouldQueue
$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 @@ class PushServerUpdateJob implements ShouldBeEncrypted, ShouldQueue
instant_remote_process($connectProxyToDockerNetworks, $this->server, false);
}
}
}
private function updateDatabaseStatus(string $databaseUuid, string $containerStatus, bool $tcpProxy = false)

View File

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

View File

@@ -94,11 +94,9 @@ class ServerCheckJob implements ShouldBeEncrypted, ShouldQueue
}
}
}
} catch (\Throwable $e) {
return handleError($e);
}
}
private function checkLogDrainContainer()

View File

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

View File

@@ -58,10 +58,8 @@ class ServerStorageCheckJob implements ShouldBeEncrypted, ShouldQueue
} else {
RateLimiter::hit('high-disk-usage:'.$this->server->id, 600);
}
} catch (\Throwable $e) {
return handleError($e);
}
}
}

View File

@@ -41,7 +41,6 @@ class UpdateCoolifyJob implements ShouldBeEncrypted, ShouldQueue
$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 @@ class Import extends Component
public function runImport()
{
if ($this->filename === '') {
$this->dispatch('error', 'Please select a file to import.');

View File

@@ -51,7 +51,6 @@ class General extends Component
$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 @@ class General extends Component
$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 @@ class General extends Component
$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 @@ class PublicGitRepository extends Component
$this->base_directory = '/'.$this->base_directory;
}
}
}
public function updatedDockerComposeLocation()

View File

@@ -100,7 +100,6 @@ class Create extends Component
'is_preview' => false,
]);
}
});
}
$service->parse(isNew: true);

View File

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

View File

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

View File

@@ -109,9 +109,7 @@ class Logs extends Component
$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 @@ class ResourceOperations extends Component
return redirect()->to($route);
}
}
public function moveTo($environment_id)

View File

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

View File

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

View File

@@ -37,7 +37,6 @@ class UploadConfig extends Component
return;
}
}
public function render()

View File

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

View File

@@ -86,7 +86,6 @@ class Form extends Component
$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 @@ class Form extends Component
public function instantSave()
{
try {
$this->validate();
refresh_server_connection($this->server->privateKey);
$this->validateServer(false);

View File

@@ -51,7 +51,6 @@ class LogDrains extends Component
public function syncData(bool $toModel = false)
{
if ($toModel) {
$this->validate();
$this->server->settings->is_logdrain_newrelic_enabled = $this->isLogDrainNewRelicEnabled;
@@ -78,7 +77,6 @@ class LogDrains extends Component
$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 @@ class Proxy extends Component
} else {
$this->dispatch('traefikDashboardAvailable', false);
}
} catch (\Throwable $e) {
return handleError($e, $this);
}

View File

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

View File

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

View File

@@ -23,11 +23,9 @@ class Upgrade extends Component
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 @@ class VerifyEmail extends Component
$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 @@ class Environment extends Model
foreach ($shared_variables as $shared_variable) {
$shared_variable->delete();
}
});
}

View File

@@ -162,7 +162,6 @@ class EnvironmentVariable extends Model
$environment_variable = trim($environment_variable);
$sharedEnvsFound = str($environment_variable)->matchAll('/{{(.*?)}}/');
if ($sharedEnvsFound->isEmpty()) {
return $environment_variable;
}

View File

@@ -36,7 +36,6 @@ class InstanceSettings extends Model implements SendsEmail
});
}
});
}
public function fqdn(): Attribute

View File

@@ -72,7 +72,6 @@ class LocalFileVolume extends BaseModel
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 @@ class Service extends BaseModel
}
$fields->put('MariaDB', $data->toArray());
break;
}
}
@@ -1304,7 +1303,6 @@ class Service extends BaseModel
} else {
return collect([]);
}
}
public function networks()

View File

@@ -30,7 +30,6 @@ class TaskFailed extends Notification implements ShouldQueue
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 @@ return new class extends Migration
{
Schema::table('subscriptions', function (Blueprint $table) {
$table->string('stripe_plan_id')->nullable()->after('stripe_cancel_at_period_end');
});
}

View File

@@ -14,7 +14,6 @@ return new class extends Migration
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 @@ return new class extends Migration
{
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 @@ return new class extends Migration
{
Schema::table('team_invitations', function (Blueprint $table) {
$table->text('link')->change();
});
}

View File

@@ -16,7 +16,6 @@ return new class extends Migration
$table->longText('description')->nullable();
$table->longText('docker_compose_raw');
$table->longText('docker_compose')->nullable();
});
}

View File

@@ -13,7 +13,6 @@ return new class extends Migration
{
Schema::table('environment_variables', function (Blueprint $table) {
$table->foreignId('service_id')->nullable();
});
}

View File

@@ -14,7 +14,6 @@ return new class extends Migration
Schema::table('services', function (Blueprint $table) {
$table->dropColumn('destination_type');
$table->dropColumn('destination_id');
});
}

View File

@@ -26,6 +26,5 @@ return new class extends Migration
$table->dropColumn('unreachable_email_sent');
$table->integer('unreachable_count')->default(0);
});
}
};

View File

@@ -22,7 +22,6 @@ return new class extends Migration
$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 @@ return new class extends Migration
Schema::table('service_databases', function (Blueprint $table) {
$table->dropSoftDeletes();
});
}
};

View File

@@ -14,7 +14,6 @@ return new class extends Migration
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 @@ return new class extends Migration
{
Schema::table('applications', function (Blueprint $table) {
$table->text('custom_docker_run_options')->nullable()->change();
});
}

View File

@@ -13,7 +13,6 @@ return new class extends Migration
{
Schema::table('application_settings', function (Blueprint $table) {
$table->boolean('connect_to_docker_network')->default(false);
});
}

View File

@@ -13,7 +13,6 @@ return new class extends Migration
{
Schema::table('applications', function (Blueprint $table) {
$table->string('manual_webhook_secret_gitea')->nullable();
});
}

View File

@@ -30,7 +30,6 @@ class AddServerCleanupFieldsToServerSettingsTable extends Migration
$serverSetting->docker_cleanup_threshold = $serverSetting->cleanup_after_percentage;
$serverSetting->save();
}
}
/**

View File

@@ -20,6 +20,5 @@ class EncryptExistingPrivateKeys extends Migration
echo 'Encrypting private keys failed.';
echo $e->getMessage();
}
}
}

View File

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

View File

@@ -128,7 +128,6 @@ Route::group([
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([