Skip to content

Commit 40f2c7a

Browse files
authored
Merge pull request coollabsio#3714 from coollabsio/next
v4.0.0-beta.356
2 parents 283fe47 + 3f8324d commit 40f2c7a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1891
-814
lines changed

app/Actions/Proxy/CheckConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function handle(Server $server, bool $reset = false)
2222
];
2323
$proxy_configuration = instant_remote_process($payload, $server, false);
2424
if ($reset || ! $proxy_configuration || is_null($proxy_configuration)) {
25-
$proxy_configuration = str(generate_default_proxy_configuration($server))->trim()->value;
25+
$proxy_configuration = str(generate_default_proxy_configuration($server))->trim()->value();
2626
}
2727
if (! $proxy_configuration || is_null($proxy_configuration)) {
2828
throw new \Exception('Could not generate proxy configuration');

app/Actions/Proxy/StartProxy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function handle(Server $server, bool $async = true, bool $force = false):
2626
}
2727
SaveConfiguration::run($server, $configuration);
2828
$docker_compose_yml_base64 = base64_encode($configuration);
29-
$server->proxy->last_applied_settings = str($docker_compose_yml_base64)->pipe('md5')->value;
29+
$server->proxy->last_applied_settings = str($docker_compose_yml_base64)->pipe('md5')->value();
3030
$server->save();
3131
if ($server->isSwarm()) {
3232
$commands = $commands->merge([

app/Console/Commands/ServicesGenerate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ private function process_file($file)
7878
if ($logo->count() > 0) {
7979
$logo = str($logo[0])->after('# logo:')->trim()->value();
8080
} else {
81-
$logo = 'svgs/unknown.svg';
81+
$logo = 'svgs/coolify.png';
8282
}
8383
$minversion = collect(preg_grep('/^# minversion:/', explode("\n", $content)))->values();
8484
if ($minversion->count() > 0) {

app/Livewire/Help.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public function submit()
6161
send_user_an_email($mail, auth()->user()?->email, '[email protected]');
6262
}
6363
$this->dispatch('success', 'Feedback sent.', 'We will get in touch with you as soon as possible.');
64+
$this->reset('description', 'subject');
6465
} catch (\Throwable $e) {
6566
return handleError($e, $this);
6667
}

app/Livewire/Project/New/Select.php

Lines changed: 113 additions & 36 deletions
Large diffs are not rendered by default.

app/Livewire/Project/Shared/EnvironmentVariable/Add.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,6 @@ public function mount()
4848
public function submit()
4949
{
5050
$this->validate();
51-
// if (str($this->value)->startsWith('{{') && str($this->value)->endsWith('}}')) {
52-
// $type = str($this->value)->after('{{')->before('.')->value;
53-
// if (! collect(SHARED_VARIABLE_TYPES)->contains($type)) {
54-
// $this->dispatch('error', 'Invalid shared variable type.', 'Valid types are: team, project, environment.');
55-
56-
// return;
57-
// }
58-
// }
5951
$this->dispatch('saveKey', [
6052
'key' => $this->key,
6153
'value' => $this->value,

app/Livewire/Project/Shared/EnvironmentVariable/All.php

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,29 +53,15 @@ public function instantSave()
5353

5454
public function sortEnvironmentVariables()
5555
{
56-
if ($this->resource->type() === 'application') {
57-
$this->resource->load(['environment_variables', 'environment_variables_preview']);
58-
} else {
59-
$this->resource->load(['environment_variables']);
60-
}
61-
62-
$sortBy = data_get($this->resource, 'settings.is_env_sorting_enabled') ? 'key' : 'order';
63-
64-
$sortFunction = function ($variables) use ($sortBy) {
65-
if (! $variables) {
66-
return $variables;
56+
if (! data_get($this->resource, 'settings.is_env_sorting_enabled')) {
57+
if ($this->resource->environment_variables) {
58+
$this->resource->environment_variables = $this->resource->environment_variables->sortBy('order')->values();
6759
}
68-
if ($sortBy === 'key') {
69-
return $variables->sortBy(function ($item) {
70-
return strtolower($item->key);
71-
}, SORT_NATURAL | SORT_FLAG_CASE)->values();
72-
} else {
73-
return $variables->sortBy('order')->values();
74-
}
75-
};
7660

77-
$this->resource->environment_variables = $sortFunction($this->resource->environment_variables);
78-
$this->resource->environment_variables_preview = $sortFunction($this->resource->environment_variables_preview);
61+
if ($this->resource->environment_variables_preview) {
62+
$this->resource->environment_variables_preview = $this->resource->environment_variables_preview->sortBy('order')->values();
63+
}
64+
}
7965

8066
$this->getDevView();
8167
}
@@ -121,6 +107,8 @@ public function submit($data = null)
121107
$this->sortEnvironmentVariables();
122108
} catch (\Throwable $e) {
123109
return handleError($e, $this);
110+
} finally {
111+
$this->refreshEnvs();
124112
}
125113
}
126114

app/Models/Project.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ class Project extends BaseModel
2424
{
2525
protected $guarded = [];
2626

27+
protected $appends = ['default_environment'];
28+
2729
public static function ownedByCurrentTeam()
2830
{
29-
return Project::whereTeamId(currentTeam()->id)->orderBy('name');
31+
return Project::whereTeamId(currentTeam()->id)->orderByRaw('LOWER(name)');
3032
}
3133

3234
protected static function booted()
@@ -131,7 +133,7 @@ public function databases()
131133
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());
132134
}
133135

134-
public function default_environment()
136+
public function getDefaultEnvironmentAttribute()
135137
{
136138
$default = $this->environments()->where('name', 'production')->first();
137139
if ($default) {

app/Models/Server.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,11 +448,19 @@ public function proxyPath()
448448
// Should move everything except /caddy and /nginx to /traefik
449449
// The code needs to be modified as well, so maybe it does not worth it
450450
if ($proxyType === ProxyTypes::TRAEFIK->value) {
451-
$proxy_path = $proxy_path;
451+
// Do nothing
452452
} elseif ($proxyType === ProxyTypes::CADDY->value) {
453-
$proxy_path = $proxy_path.'/caddy';
453+
if (isDev()) {
454+
$proxy_path = '/var/lib/docker/volumes/coolify_dev_coolify_data/_data/proxy/caddy';
455+
} else {
456+
$proxy_path = $proxy_path.'/caddy';
457+
}
454458
} elseif ($proxyType === ProxyTypes::NGINX->value) {
455-
$proxy_path = $proxy_path.'/nginx';
459+
if (isDev()) {
460+
$proxy_path = '/var/lib/docker/volumes/coolify_dev_coolify_data/_data/proxy/nginx';
461+
} else {
462+
$proxy_path = $proxy_path.'/nginx';
463+
}
456464
}
457465

458466
return $proxy_path;

0 commit comments

Comments
 (0)