remove instance wide wildcard domain

This commit is contained in:
Andras Bacsai 2023-06-23 10:48:41 +02:00
parent 697bbe29bc
commit 13a08ebbe1
5 changed files with 31 additions and 67 deletions

View File

@ -20,20 +20,19 @@ class Configuration extends Component
protected $rules = [
'settings.fqdn' => 'nullable',
'settings.wildcard_domain' => 'nullable',
'settings.public_port_min' => 'required',
'settings.public_port_max' => 'required',
'settings.default_redirect_404' => 'nullable',
];
protected $validationAttributes = [
'settings.fqdn' => 'FQDN',
'settings.wildcard_domain' => 'Wildcard domain',
'settings.public_port_min' => 'Public port min',
'settings.public_port_max' => 'Public port max',
'settings.default_redirect_404' => 'Default redirect 404',
];
public function mount()
{
ray($this->settings);
$this->do_not_track = $this->settings->do_not_track;
$this->is_auto_update_enabled = $this->settings->is_auto_update_enabled;
$this->is_registration_enabled = $this->settings->is_registration_enabled;
@ -108,67 +107,6 @@ private function setup_instance_fqdn()
$this->save_configuration_to_disk($traefik_dynamic_conf, $file);
}
}
private function setup_default_redirect_404()
{
$file = "$this->dynamic_config_path/default_redirect_404.yaml";
if (empty($this->settings->default_redirect_404)) {
remote_process([
"rm -f $file",
], $this->server);
} else {
$traefik_dynamic_conf = [
'http' =>
[
'routers' =>
[
'catchall' =>
[
'entryPoints' => [
0 => 'http',
1 => 'https',
],
'service' => 'noop',
'rule' => "HostRegexp(`{catchall:.*}`)",
'priority' => 1,
'middlewares' => [
0 => 'redirect-regexp@file',
],
],
],
'services' =>
[
'noop' =>
[
'loadBalancer' =>
[
'servers' =>
[
0 =>
[
'url' => '',
],
],
],
],
],
'middlewares' =>
[
'redirect-regexp' =>
[
'redirectRegex' =>
[
'regex' => '(.*)',
'replacement' => $this->settings->default_redirect_404,
'permanent' => false,
],
],
],
],
];
$this->save_configuration_to_disk($traefik_dynamic_conf, $file);
}
}
private function save_configuration_to_disk(array $traefik_dynamic_conf, string $file)
{
$yaml = Yaml::dump($traefik_dynamic_conf, 12, 2);

View File

@ -1,3 +1,3 @@
<?php
return '4.0.0-beta.8';
return '4.0.0-beta.9';

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('instance_settings', function (Blueprint $table) {
$table->dropColumn('wildcard_domain');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('instancesettings', function (Blueprint $table) {
$table->string('wildcard_domain')->nullable();
});
}
};

View File

@ -9,8 +9,6 @@
<div class="flex flex-col gap-2">
<div class="flex gap-2">
<x-forms.input id="settings.fqdn" label="Coolify's Domain" />
<x-forms.input id="settings.wildcard_domain" label="Wildcard Domain"
helper="Wildcard domain for your applications. If you set this, you will get a random generated domain for your new applications.<br><span class='font-bold text-white'>Example</span>In case you set:<span class='text-helper'>https://example.com</span>your applications will get: <span class='text-helper'>https://randomId.example.com</span>" />
<x-forms.input id="settings.default_redirect_404" label="Default Redirect 404"
helper="All urls that has no service available will be redirected to this domain.<span class='text-helper'>You can set to your main marketing page or your social media link.</span>" />
</div>

View File

@ -4,7 +4,7 @@
"version": "3.12.32"
},
"v4": {
"version": "4.0.0-beta.8"
"version": "4.0.0-beta.9"
}
}
}