Merge pull request #2629 from Thijmen/instance-name

Ability to give a name to an instance
This commit is contained in:
Andras Bacsai 2024-06-24 11:23:41 +02:00 committed by GitHub
commit 4c652b5818
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 55 additions and 1 deletions

View File

@ -29,6 +29,7 @@ class Configuration extends Component
'settings.public_port_min' => 'required', 'settings.public_port_min' => 'required',
'settings.public_port_max' => 'required', 'settings.public_port_max' => 'required',
'settings.custom_dns_servers' => 'nullable', 'settings.custom_dns_servers' => 'nullable',
'settings.instance_name' => 'nullable',
]; ];
protected $validationAttributes = [ protected $validationAttributes = [

View File

@ -47,4 +47,14 @@ public function getRecepients($notification)
return explode(',', $recipients); return explode(',', $recipients);
} }
public function getTitleDisplayName(): string
{
$instanceName = $this->instance_name;
if (! $instanceName) {
return '';
}
return "[{$instanceName}]";
}
} }

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->string('instance_name')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('instance_settings', function (Blueprint $table) {
$table->dropColumn('instance_name');
});
}
};

View File

@ -15,7 +15,21 @@
<link rel="preload" href="https://cdn.fonts.coollabs.io/inter/normal/800.woff2" as="style" /> <link rel="preload" href="https://cdn.fonts.coollabs.io/inter/normal/800.woff2" as="style" />
<link href="https://api.fonts.coollabs.io/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet"> <link href="https://api.fonts.coollabs.io/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
<meta name="robots" content="noindex"> <meta name="robots" content="noindex">
<title>{{ $title ?? 'Coolify' }}</title> @use('App\Models\InstanceSettings')
@php
$instanceSettings = InstanceSettings::first();
$name = null;
if($instanceSettings) {
$displayName = $instanceSettings->getTitleDisplayName();
if(strlen($displayName) > 0) {
$name = $displayName . ' ';
}
}
@endphp
<title>{{ $name }}{{ $title ?? 'Coolify' }}</title>
@env('local') @env('local')
<link rel="icon" href="{{ asset('favicon-dev.png') }}" type="image/x-icon" /> <link rel="icon" href="{{ asset('favicon-dev.png') }}" type="image/x-icon" />
@else @else

View File

@ -11,6 +11,7 @@
<div class="flex flex-col gap-2 pt-4"> <div class="flex flex-col gap-2 pt-4">
<div class="flex flex-wrap items-end gap-2"> <div class="flex flex-wrap items-end gap-2">
<x-forms.input id="settings.fqdn" label="Instance's Domain" placeholder="https://coolify.io" /> <x-forms.input id="settings.fqdn" label="Instance's Domain" placeholder="https://coolify.io" />
<x-forms.input id="settings.instance_name" label="Instance's Name" placeholder="Coolify" />
<x-forms.input id="settings.custom_dns_servers" label="DNS Servers" <x-forms.input id="settings.custom_dns_servers" label="DNS Servers"
helper="DNS servers for validation FQDNs againts. A comma separated list of DNS servers." helper="DNS servers for validation FQDNs againts. A comma separated list of DNS servers."
placeholder="1.1.1.1,8.8.8.8" /> placeholder="1.1.1.1,8.8.8.8" />