Skip to content

Commit

Permalink
Merge pull request #3714 from coollabsio/next
Browse files Browse the repository at this point in the history
v4.0.0-beta.356
  • Loading branch information
andrasbacsai authored Oct 7, 2024
2 parents 283fe47 + 3f8324d commit 40f2c7a
Show file tree
Hide file tree
Showing 66 changed files with 1,891 additions and 814 deletions.
2 changes: 1 addition & 1 deletion app/Actions/Proxy/CheckConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function handle(Server $server, bool $reset = false)
];
$proxy_configuration = instant_remote_process($payload, $server, false);
if ($reset || ! $proxy_configuration || is_null($proxy_configuration)) {
$proxy_configuration = str(generate_default_proxy_configuration($server))->trim()->value;
$proxy_configuration = str(generate_default_proxy_configuration($server))->trim()->value();
}
if (! $proxy_configuration || is_null($proxy_configuration)) {
throw new \Exception('Could not generate proxy configuration');
Expand Down
2 changes: 1 addition & 1 deletion app/Actions/Proxy/StartProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function handle(Server $server, bool $async = true, bool $force = false):
}
SaveConfiguration::run($server, $configuration);
$docker_compose_yml_base64 = base64_encode($configuration);
$server->proxy->last_applied_settings = str($docker_compose_yml_base64)->pipe('md5')->value;
$server->proxy->last_applied_settings = str($docker_compose_yml_base64)->pipe('md5')->value();
$server->save();
if ($server->isSwarm()) {
$commands = $commands->merge([
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/ServicesGenerate.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private function process_file($file)
if ($logo->count() > 0) {
$logo = str($logo[0])->after('# logo:')->trim()->value();
} else {
$logo = 'svgs/unknown.svg';
$logo = 'svgs/coolify.png';
}
$minversion = collect(preg_grep('/^# minversion:/', explode("\n", $content)))->values();
if ($minversion->count() > 0) {
Expand Down
1 change: 1 addition & 0 deletions app/Livewire/Help.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function submit()
send_user_an_email($mail, auth()->user()?->email, '[email protected]');
}
$this->dispatch('success', 'Feedback sent.', 'We will get in touch with you as soon as possible.');
$this->reset('description', 'subject');
} catch (\Throwable $e) {
return handleError($e, $this);
}
Expand Down
149 changes: 113 additions & 36 deletions app/Livewire/Project/New/Select.php

Large diffs are not rendered by default.

8 changes: 0 additions & 8 deletions app/Livewire/Project/Shared/EnvironmentVariable/Add.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,6 @@ public function mount()
public function submit()
{
$this->validate();
// if (str($this->value)->startsWith('{{') && str($this->value)->endsWith('}}')) {
// $type = str($this->value)->after('{{')->before('.')->value;
// if (! collect(SHARED_VARIABLE_TYPES)->contains($type)) {
// $this->dispatch('error', 'Invalid shared variable type.', 'Valid types are: team, project, environment.');

// return;
// }
// }
$this->dispatch('saveKey', [
'key' => $this->key,
'value' => $this->value,
Expand Down
30 changes: 9 additions & 21 deletions app/Livewire/Project/Shared/EnvironmentVariable/All.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,29 +53,15 @@ public function instantSave()

public function sortEnvironmentVariables()
{
if ($this->resource->type() === 'application') {
$this->resource->load(['environment_variables', 'environment_variables_preview']);
} else {
$this->resource->load(['environment_variables']);
}

$sortBy = data_get($this->resource, 'settings.is_env_sorting_enabled') ? 'key' : 'order';

$sortFunction = function ($variables) use ($sortBy) {
if (! $variables) {
return $variables;
if (! data_get($this->resource, 'settings.is_env_sorting_enabled')) {
if ($this->resource->environment_variables) {
$this->resource->environment_variables = $this->resource->environment_variables->sortBy('order')->values();
}
if ($sortBy === 'key') {
return $variables->sortBy(function ($item) {
return strtolower($item->key);
}, SORT_NATURAL | SORT_FLAG_CASE)->values();
} else {
return $variables->sortBy('order')->values();
}
};

$this->resource->environment_variables = $sortFunction($this->resource->environment_variables);
$this->resource->environment_variables_preview = $sortFunction($this->resource->environment_variables_preview);
if ($this->resource->environment_variables_preview) {
$this->resource->environment_variables_preview = $this->resource->environment_variables_preview->sortBy('order')->values();
}
}

$this->getDevView();
}
Expand Down Expand Up @@ -121,6 +107,8 @@ public function submit($data = null)
$this->sortEnvironmentVariables();
} catch (\Throwable $e) {
return handleError($e, $this);
} finally {
$this->refreshEnvs();
}
}

Expand Down
6 changes: 4 additions & 2 deletions app/Models/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ class Project extends BaseModel
{
protected $guarded = [];

protected $appends = ['default_environment'];

public static function ownedByCurrentTeam()
{
return Project::whereTeamId(currentTeam()->id)->orderBy('name');
return Project::whereTeamId(currentTeam()->id)->orderByRaw('LOWER(name)');
}

protected static function booted()
Expand Down Expand Up @@ -131,7 +133,7 @@ public function databases()
return $this->postgresqls()->get()->merge($this->redis()->get())->merge($this->mongodbs()->get())->merge($this->mysqls()->get())->merge($this->mariadbs()->get())->merge($this->keydbs()->get())->merge($this->dragonflies()->get())->merge($this->clickhouses()->get());
}

public function default_environment()
public function getDefaultEnvironmentAttribute()
{
$default = $this->environments()->where('name', 'production')->first();
if ($default) {
Expand Down
14 changes: 11 additions & 3 deletions app/Models/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,19 @@ public function proxyPath()
// Should move everything except /caddy and /nginx to /traefik
// The code needs to be modified as well, so maybe it does not worth it
if ($proxyType === ProxyTypes::TRAEFIK->value) {
$proxy_path = $proxy_path;
// Do nothing
} elseif ($proxyType === ProxyTypes::CADDY->value) {
$proxy_path = $proxy_path.'/caddy';
if (isDev()) {
$proxy_path = '/var/lib/docker/volumes/coolify_dev_coolify_data/_data/proxy/caddy';
} else {
$proxy_path = $proxy_path.'/caddy';
}
} elseif ($proxyType === ProxyTypes::NGINX->value) {
$proxy_path = $proxy_path.'/nginx';
if (isDev()) {
$proxy_path = '/var/lib/docker/volumes/coolify_dev_coolify_data/_data/proxy/nginx';
} else {
$proxy_path = $proxy_path.'/nginx';
}
}

return $proxy_path;
Expand Down
Loading

0 comments on commit 40f2c7a

Please sign in to comment.