refactor(http-basic-auth): rename 'http_basic_auth_enable' to 'http_basic_auth_enabled' across application files for consistency

This commit is contained in:
Andras Bacsai
2025-04-22 21:30:27 +02:00
parent 7e0373e439
commit 9e608f7ba5
5 changed files with 17 additions and 18 deletions

View File

@@ -94,7 +94,7 @@ class General extends Component
'application.settings.is_preserve_repository_enabled' => 'boolean|required', 'application.settings.is_preserve_repository_enabled' => 'boolean|required',
'application.watch_paths' => 'nullable', 'application.watch_paths' => 'nullable',
'application.redirect' => 'string|required', 'application.redirect' => 'string|required',
'application.http_basic_auth_enable' => 'boolean|required', 'application.http_basic_auth_enabled' => 'boolean|required',
'application.http_basic_auth_username' => 'nullable', 'application.http_basic_auth_username' => 'nullable',
'application.http_basic_auth_password' => 'nullable', 'application.http_basic_auth_password' => 'nullable',
]; ];

View File

@@ -103,7 +103,7 @@ use Visus\Cuid2\Cuid2;
'deleted_at' => ['type' => 'string', 'format' => 'date-time', 'nullable' => true, 'description' => 'The date and time when the application was deleted.'], 'deleted_at' => ['type' => 'string', 'format' => 'date-time', 'nullable' => true, 'description' => 'The date and time when the application was deleted.'],
'compose_parsing_version' => ['type' => 'string', 'description' => 'How Coolify parse the compose file.'], 'compose_parsing_version' => ['type' => 'string', 'description' => 'How Coolify parse the compose file.'],
'custom_nginx_configuration' => ['type' => 'string', 'nullable' => true, 'description' => 'Custom Nginx configuration base64 encoded.'], 'custom_nginx_configuration' => ['type' => 'string', 'nullable' => true, 'description' => 'Custom Nginx configuration base64 encoded.'],
'http_basic_auth_enable' => ['type' => 'boolean', 'description' => 'HTTP Basic Authentication enabled.'], 'http_basic_auth_enabled' => ['type' => 'boolean', 'description' => 'HTTP Basic Authentication enabled.'],
'http_basic_auth_username' => ['type' => 'string', 'nullable' => true, 'description' => 'Username for HTTP Basic Authentication'], 'http_basic_auth_username' => ['type' => 'string', 'nullable' => true, 'description' => 'Username for HTTP Basic Authentication'],
'http_basic_auth_password' => ['type' => 'string', 'nullable' => true, 'description' => 'Password for HTTP Basic Authentication'], 'http_basic_auth_password' => ['type' => 'string', 'nullable' => true, 'description' => 'Password for HTTP Basic Authentication'],
] ]

View File

@@ -344,9 +344,6 @@ function fqdnLabelsForCaddy(string $network, string $uuid, Collection $domains,
if ($redirect_direction === 'non-www' && str($host)->startsWith('www.')) { if ($redirect_direction === 'non-www' && str($host)->startsWith('www.')) {
$labels->push("caddy_{$loop}.redir={$schema}://{$host_without_www}{uri}"); $labels->push("caddy_{$loop}.redir={$schema}://{$host_without_www}{uri}");
} }
if (isDev()) {
// $labels->push("caddy_{$loop}.tls=internal");
}
if ($http_basic_auth_enabled) { if ($http_basic_auth_enabled) {
$http_basic_auth_password = password_hash($http_basic_auth_password, PASSWORD_BCRYPT, ['cost' => 10]); $http_basic_auth_password = password_hash($http_basic_auth_password, PASSWORD_BCRYPT, ['cost' => 10]);
$labels->push("caddy_{$loop}.basicauth.{$http_basic_auth_username}=\"{$http_basic_auth_password}\""); $labels->push("caddy_{$loop}.basicauth.{$http_basic_auth_username}=\"{$http_basic_auth_password}\"");
@@ -585,6 +582,7 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
if ($pull_request_id !== 0) { if ($pull_request_id !== 0) {
$appUuid = $appUuid.'-pr-'.$pull_request_id; $appUuid = $appUuid.'-pr-'.$pull_request_id;
} }
ray($application);
$labels = collect([]); $labels = collect([]);
if ($pull_request_id === 0) { if ($pull_request_id === 0) {
if ($application->fqdn) { if ($application->fqdn) {
@@ -601,7 +599,7 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
is_gzip_enabled: $application->isGzipEnabled(), is_gzip_enabled: $application->isGzipEnabled(),
is_stripprefix_enabled: $application->isStripprefixEnabled(), is_stripprefix_enabled: $application->isStripprefixEnabled(),
redirect_direction: $application->redirect, redirect_direction: $application->redirect,
http_basic_auth_enabled: $application->http_basic_auth_enable, http_basic_auth_enabled: $application->http_basic_auth_enabled,
http_basic_auth_username: $application->http_basic_auth_username, http_basic_auth_username: $application->http_basic_auth_username,
http_basic_auth_password: $application->http_basic_auth_password, http_basic_auth_password: $application->http_basic_auth_password,
)); ));
@@ -631,7 +629,7 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
is_gzip_enabled: $application->isGzipEnabled(), is_gzip_enabled: $application->isGzipEnabled(),
is_stripprefix_enabled: $application->isStripprefixEnabled(), is_stripprefix_enabled: $application->isStripprefixEnabled(),
redirect_direction: $application->redirect, redirect_direction: $application->redirect,
http_basic_auth_enabled: $application->http_basic_auth_enable, http_basic_auth_enabled: $application->http_basic_auth_enabled,
http_basic_auth_username: $application->http_basic_auth_username, http_basic_auth_username: $application->http_basic_auth_username,
http_basic_auth_password: $application->http_basic_auth_password, http_basic_auth_password: $application->http_basic_auth_password,
)); ));
@@ -644,7 +642,7 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
is_gzip_enabled: $application->isGzipEnabled(), is_gzip_enabled: $application->isGzipEnabled(),
is_stripprefix_enabled: $application->isStripprefixEnabled(), is_stripprefix_enabled: $application->isStripprefixEnabled(),
redirect_direction: $application->redirect, redirect_direction: $application->redirect,
http_basic_auth_enabled: $application->http_basic_auth_enable, http_basic_auth_enabled: $application->http_basic_auth_enabled,
http_basic_auth_username: $application->http_basic_auth_username, http_basic_auth_username: $application->http_basic_auth_username,
http_basic_auth_password: $application->http_basic_auth_password, http_basic_auth_password: $application->http_basic_auth_password,
)); ));
@@ -667,7 +665,7 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
is_force_https_enabled: $application->isForceHttpsEnabled(), is_force_https_enabled: $application->isForceHttpsEnabled(),
is_gzip_enabled: $application->isGzipEnabled(), is_gzip_enabled: $application->isGzipEnabled(),
is_stripprefix_enabled: $application->isStripprefixEnabled(), is_stripprefix_enabled: $application->isStripprefixEnabled(),
http_basic_auth_enabled: $application->http_basic_auth_enable, http_basic_auth_enabled: $application->http_basic_auth_enabled,
http_basic_auth_username: $application->http_basic_auth_username, http_basic_auth_username: $application->http_basic_auth_username,
http_basic_auth_password: $application->http_basic_auth_password, http_basic_auth_password: $application->http_basic_auth_password,
)); ));
@@ -681,7 +679,7 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
is_force_https_enabled: $application->isForceHttpsEnabled(), is_force_https_enabled: $application->isForceHttpsEnabled(),
is_gzip_enabled: $application->isGzipEnabled(), is_gzip_enabled: $application->isGzipEnabled(),
is_stripprefix_enabled: $application->isStripprefixEnabled(), is_stripprefix_enabled: $application->isStripprefixEnabled(),
http_basic_auth_enabled: $application->http_basic_auth_enable, http_basic_auth_enabled: $application->http_basic_auth_enabled,
http_basic_auth_username: $application->http_basic_auth_username, http_basic_auth_username: $application->http_basic_auth_username,
http_basic_auth_password: $application->http_basic_auth_password, http_basic_auth_password: $application->http_basic_auth_password,
)); ));
@@ -695,7 +693,7 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
is_force_https_enabled: $application->isForceHttpsEnabled(), is_force_https_enabled: $application->isForceHttpsEnabled(),
is_gzip_enabled: $application->isGzipEnabled(), is_gzip_enabled: $application->isGzipEnabled(),
is_stripprefix_enabled: $application->isStripprefixEnabled(), is_stripprefix_enabled: $application->isStripprefixEnabled(),
http_basic_auth_enabled: $application->http_basic_auth_enable, http_basic_auth_enabled: $application->http_basic_auth_enabled,
http_basic_auth_username: $application->http_basic_auth_username, http_basic_auth_username: $application->http_basic_auth_username,
http_basic_auth_password: $application->http_basic_auth_password, http_basic_auth_password: $application->http_basic_auth_password,
)); ));
@@ -707,7 +705,7 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
is_force_https_enabled: $application->isForceHttpsEnabled(), is_force_https_enabled: $application->isForceHttpsEnabled(),
is_gzip_enabled: $application->isGzipEnabled(), is_gzip_enabled: $application->isGzipEnabled(),
is_stripprefix_enabled: $application->isStripprefixEnabled(), is_stripprefix_enabled: $application->isStripprefixEnabled(),
http_basic_auth_enabled: $application->http_basic_auth_enable, http_basic_auth_enabled: $application->http_basic_auth_enabled,
http_basic_auth_username: $application->http_basic_auth_username, http_basic_auth_username: $application->http_basic_auth_username,
http_basic_auth_password: $application->http_basic_auth_password, http_basic_auth_password: $application->http_basic_auth_password,
)); ));

View File

@@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void public function up(): void
{ {
Schema::table('applications', function (Blueprint $table) { Schema::table('applications', function (Blueprint $table) {
$table->boolean('http_basic_auth_enable')->default(false); $table->boolean('http_basic_auth_enabled')->default(false);
$table->string('http_basic_auth_username')->nullable(true)->default(null); $table->string('http_basic_auth_username')->nullable(true)->default(null);
$table->string('http_basic_auth_password')->nullable(true)->default(null); $table->string('http_basic_auth_password')->nullable(true)->default(null);
}); });
@@ -24,7 +24,7 @@ return new class extends Migration
public function down(): void public function down(): void
{ {
Schema::table('applications', function (Blueprint $table) { Schema::table('applications', function (Blueprint $table) {
$table->dropColumn('http_basic_auth_enable'); $table->dropColumn('http_basic_auth_enabled');
$table->dropColumn('http_basic_auth_username'); $table->dropColumn('http_basic_auth_username');
$table->dropColumn('http_basic_auth_password'); $table->dropColumn('http_basic_auth_password');
}); });

View File

@@ -350,14 +350,15 @@
</div> </div>
<h3 class="pt-8">HTTP Basic Authentication</h3> <h3 class="pt-8">HTTP Basic Authentication</h3>
<div x-data="{enabled: {{ $application->http_basic_auth_enable ? "true" : "false" }}}"> <div x-data="{ enabled: {{ $application->http_basic_auth_enabled ? 'true' : 'false' }} }">
<div class="w-96"> <div class="w-96">
<x-forms.checkbox label="Enable" id="application.http_basic_auth_enable" x-model="enabled" /> <x-forms.checkbox helper="This will add the proper proxy labels to the container."
label="Enable" id="application.http_basic_auth_enabled" x-model="enabled" />
</div> </div>
<div class="w-96" x-show="enabled"> <div class="flex gap-2 py-2" x-show="enabled">
<x-forms.input id="application.http_basic_auth_username" label="Username" /> <x-forms.input id="application.http_basic_auth_username" label="Username" />
<x-forms.input id="application.http_basic_auth_password" label="Password" /> <x-forms.input id="application.http_basic_auth_password" type="password" label="Password" />
</div> </div>
</div> </div>