Refactor dynamic configurations and update textarea rows

This commit is contained in:
Andras Bacsai 2024-03-13 09:32:42 +01:00
parent 2f1a7f8f40
commit 65e0eb5205
2 changed files with 2 additions and 6 deletions

View File

@ -30,10 +30,6 @@ public function loadDynamicConfigurations()
$files = collect(explode("\n", $files))->filter(fn ($file) => !empty($file)); $files = collect(explode("\n", $files))->filter(fn ($file) => !empty($file));
$files = $files->map(fn ($file) => trim($file)); $files = $files->map(fn ($file) => trim($file));
$files = $files->sort(); $files = $files->sort();
if ($files->contains('coolify.yaml')) {
$files = $files->filter(fn ($file) => $file !== 'coolify.yaml')->prepend('coolify.yaml');
$files = $files->filter(fn ($file) => $file !== 'Caddyfile')->prepend('Caddyfile');
}
$contents = collect([]); $contents = collect([]);
foreach ($files as $file) { foreach ($files as $file) {
$without_extension = str_replace('.', '|', $file); $without_extension = str_replace('.', '|', $file);

View File

@ -29,12 +29,12 @@ class="font-normal text-white normal-case border-none rounded btn btn-primary bt
@if ($contents?->isNotEmpty()) @if ($contents?->isNotEmpty())
@foreach ($contents as $fileName => $value) @foreach ($contents as $fileName => $value)
<div class="flex flex-col gap-2 py-2"> <div class="flex flex-col gap-2 py-2">
@if (str_replace('|', '.', $fileName) === 'coolify.yaml' ||str_replace('|', '.', $fileName) === 'Caddyfile' ) @if (str_replace('|', '.', $fileName) === 'coolify.yaml' || str_replace('|', '.', $fileName) === 'Caddyfile' || str_replace('|', '.', $fileName) === 'coolify.caddy' || str_replace('|', '.', $fileName) === 'default_redirect_404.caddy')
<div> <div>
<h3 class="text-white">File: {{ str_replace('|', '.', $fileName) }}</h3> <h3 class="text-white">File: {{ str_replace('|', '.', $fileName) }}</h3>
</div> </div>
<x-forms.textarea disabled name="proxy_settings" <x-forms.textarea disabled name="proxy_settings"
wire:model="contents.{{ $fileName }}" rows="10" /> wire:model="contents.{{ $fileName }}" rows="5" />
@else @else
<livewire:server.proxy.dynamic-configuration-navbar :server_id="$server->id" <livewire:server.proxy.dynamic-configuration-navbar :server_id="$server->id"
:fileName="$fileName" :value="$value" :newFile="false" :fileName="$fileName" :value="$value" :newFile="false"