Skip to content

Commit

Permalink
Merge pull request coollabsio#2629 from Thijmen/instance-name
Browse files Browse the repository at this point in the history
Ability to give a name to an instance
  • Loading branch information
andrasbacsai authored Jun 24, 2024
2 parents 5201818 + 7e9e333 commit 4c652b5
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/Livewire/Settings/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class Configuration extends Component
'settings.public_port_min' => 'required',
'settings.public_port_max' => 'required',
'settings.custom_dns_servers' => 'nullable',
'settings.instance_name' => 'nullable',
];

protected $validationAttributes = [
Expand Down
10 changes: 10 additions & 0 deletions app/Models/InstanceSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,14 @@ public function getRecepients($notification)

return explode(',', $recipients);
}

public function getTitleDisplayName(): string
{
$instanceName = $this->instance_name;
if (! $instanceName) {
return '';
}

return "[{$instanceName}]";
}
}
Original file line number Diff line number Diff line change
@@ -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');
});
}
};
16 changes: 15 additions & 1 deletion resources/views/layouts/base.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,21 @@
<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">
<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')
<link rel="icon" href="{{ asset('favicon-dev.png') }}" type="image/x-icon" />
@else
Expand Down
1 change: 1 addition & 0 deletions resources/views/livewire/settings/configuration.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<div class="flex flex-col gap-2 pt-4">
<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.instance_name" label="Instance's Name" placeholder="Coolify" />
<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."
placeholder="1.1.1.1,8.8.8.8" />
Expand Down

0 comments on commit 4c652b5

Please sign in to comment.