This commit is contained in:
Andras Bacsai
2024-12-02 22:49:55 +01:00
parent 58988d3686
commit 319c3023dc
8 changed files with 90 additions and 88 deletions

View File

@@ -260,7 +260,7 @@ class GetContainersStatus
$environmentName = data_get($service, 'environment.name');
if ($projectUuid && $serviceUuid && $environmentName) {
$url = base_url() . '/project/' . $projectUuid . '/' . $environmentName . '/service/' . $serviceUuid;
$url = base_url().'/project/'.$projectUuid.'/'.$environmentName.'/service/'.$serviceUuid;
} else {
$url = null;
}
@@ -286,7 +286,7 @@ class GetContainersStatus
$environment = data_get($application, 'environment.name');
if ($projectUuid && $applicationUuid && $environment) {
$url = base_url() . '/project/' . $projectUuid . '/' . $environment . '/application/' . $applicationUuid;
$url = base_url().'/project/'.$projectUuid.'/'.$environment.'/application/'.$applicationUuid;
} else {
$url = null;
}
@@ -311,7 +311,7 @@ class GetContainersStatus
$applicationUuid = data_get($preview, 'application.uuid');
if ($projectUuid && $applicationUuid && $environmentName) {
$url = base_url() . '/project/' . $projectUuid . '/' . $environmentName . '/application/' . $applicationUuid;
$url = base_url().'/project/'.$projectUuid.'/'.$environmentName.'/application/'.$applicationUuid;
} else {
$url = null;
}
@@ -336,7 +336,7 @@ class GetContainersStatus
$databaseUuid = data_get($database, 'uuid');
if ($projectUuid && $databaseUuid && $environmentName) {
$url = base_url() . '/project/' . $projectUuid . '/' . $environmentName . '/database/' . $databaseUuid;
$url = base_url().'/project/'.$projectUuid.'/'.$environmentName.'/database/'.$databaseUuid;
} else {
$url = null;
}

View File

@@ -213,7 +213,7 @@ class ServerCheck
if ($isPublic) {
$foundTcpProxy = $this->containers->filter(function ($value, $key) use ($uuid) {
if ($this->isSentinel) {
return data_get($value, 'name') === $uuid . '-proxy';
return data_get($value, 'name') === $uuid.'-proxy';
} else {
if ($this->server->isSwarm()) {
@@ -245,7 +245,7 @@ class ServerCheck
if ($isPublic) {
$foundTcpProxy = $this->containers->filter(function ($value, $key) use ($uuid) {
if ($this->isSentinel) {
return data_get($value, 'name') === $uuid . '-proxy';
return data_get($value, 'name') === $uuid.'-proxy';
} else {
if ($this->server->isSwarm()) {
return data_get($value, 'Spec.Name') === "coolify-proxy_$uuid";

View File

@@ -308,7 +308,7 @@ class ServicesController extends Controller
}
if ($oneClickService) {
$service_payload = [
'name' => "$oneClickServiceName-" . str()->random(10),
'name' => "$oneClickServiceName-".str()->random(10),
'docker_compose_raw' => base64_decode($oneClickService),
'environment_id' => $environment->id,
'service_type' => $oneClickServiceName,
@@ -320,7 +320,7 @@ class ServicesController extends Controller
data_set($service_payload, 'connect_to_docker_network', true);
}
$service = Service::create($service_payload);
$service->name = "$oneClickServiceName-" . $service->uuid;
$service->name = "$oneClickServiceName-".$service->uuid;
$service->save();
if ($oneClickDotEnvs?->count() > 0) {
$oneClickDotEnvs->each(function ($value) use ($service) {

View File

@@ -280,7 +280,7 @@ class PushServerUpdateJob implements ShouldBeEncrypted, ShouldQueue
})->first();
if (! $tcpProxyContainerFound) {
StartDatabaseProxy::dispatch($database);
$this->server->team?->notify(new ContainerRestarted("TCP Proxy for database", $this->server));
$this->server->team?->notify(new ContainerRestarted('TCP Proxy for database', $this->server));
} else {
}
}

View File

@@ -19,16 +19,18 @@ abstract class BaseModel extends Model
}
});
}
public function name(): Attribute
{
return new Attribute(
get: fn() => sanitize_string($this->getRawOriginal('name')),
get: fn () => sanitize_string($this->getRawOriginal('name')),
);
}
public function image(): Attribute
{
return new Attribute(
get: fn() => sanitize_string($this->getRawOriginal('image')),
get: fn () => sanitize_string($this->getRawOriginal('image')),
);
}
}

View File

@@ -25,7 +25,7 @@ class StandalonePostgresql extends BaseModel
{
static::created(function ($database) {
LocalPersistentVolume::create([
'name' => 'postgres-data-' . $database->uuid,
'name' => 'postgres-data-'.$database->uuid,
'mount_path' => '/var/lib/postgresql/data',
'host_path' => null,
'resource_id' => $database->id,
@@ -48,7 +48,7 @@ class StandalonePostgresql extends BaseModel
public function workdir()
{
return database_configuration_dir() . "/{$this->uuid}";
return database_configuration_dir()."/{$this->uuid}";
}
protected function serverStatus(): Attribute
@@ -65,7 +65,7 @@ class StandalonePostgresql extends BaseModel
$server = data_get($this, 'destination.server');
$workdir = $this->workdir();
if (str($workdir)->endsWith($this->uuid)) {
instant_remote_process(['rm -rf ' . $this->workdir()], $server, false);
instant_remote_process(['rm -rf '.$this->workdir()], $server, false);
}
}
@@ -82,7 +82,7 @@ class StandalonePostgresql extends BaseModel
public function isConfigurationChanged(bool $save = false)
{
$newConfigHash = $this->image . $this->ports_mappings . $this->postgres_initdb_args . $this->postgres_host_auth_method;
$newConfigHash = $this->image.$this->ports_mappings.$this->postgres_initdb_args.$this->postgres_host_auth_method;
$newConfigHash .= json_encode($this->environment_variables()->get('value')->sort());
$newConfigHash = md5($newConfigHash);
$oldConfigHash = data_get($this, 'config_hash');
@@ -186,14 +186,14 @@ class StandalonePostgresql extends BaseModel
public function portsMappings(): Attribute
{
return Attribute::make(
set: fn($value) => $value === '' ? null : $value,
set: fn ($value) => $value === '' ? null : $value,
);
}
public function portsMappingsArray(): Attribute
{
return Attribute::make(
get: fn() => is_null($this->ports_mappings)
get: fn () => is_null($this->ports_mappings)
? []
: explode(',', $this->ports_mappings),
@@ -208,7 +208,7 @@ class StandalonePostgresql extends BaseModel
public function databaseType(): Attribute
{
return new Attribute(
get: fn() => $this->type(),
get: fn () => $this->type(),
);
}
@@ -220,7 +220,7 @@ class StandalonePostgresql extends BaseModel
protected function internalDbUrl(): Attribute
{
return new Attribute(
get: fn() => "postgres://{$this->postgres_user}:{$this->postgres_password}@{$this->uuid}:5432/{$this->postgres_db}",
get: fn () => "postgres://{$this->postgres_user}:{$this->postgres_password}@{$this->uuid}:5432/{$this->postgres_db}",
);
}

View File

@@ -130,7 +130,7 @@ class Team extends Model implements SendsDiscord, SendsEmail
public function name(): Attribute
{
return new Attribute(
get: fn() => sanitize_string($this->getRawOriginal('name')),
get: fn () => sanitize_string($this->getRawOriginal('name')),
);
}