An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
revert: instancesettings
Andras Bacsai0f55e83591e5
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.phpindex d382dedfe8..6b69350fe5 100644--- a/app/Exceptions/Handler.php+++ b/app/Exceptions/Handler.php@@ -65,7 +65,7 @@ class Handler extends ExceptionHandlerif ($e instanceof RuntimeException) {return;}- $this->settings = view()->shared('instanceSettings');+ $this->settings = \App\Models\InstanceSettings::get();if ($this->settings->do_not_track) {return;}diff --git a/app/Http/Controllers/Api/OtherController.php b/app/Http/Controllers/Api/OtherController.phpindex 917ccc857c..1e48ffdbe7 100644--- a/app/Http/Controllers/Api/OtherController.php+++ b/app/Http/Controllers/Api/OtherController.php@@ -84,7 +84,7 @@ class OtherController extends Controllerif ($teamId !== '0') {return response()->json(['message' => 'You are not allowed to enable the API.'], 403);}- $settings = view()->shared('instanceSettings');+ $settings = \App\Models\InstanceSettings::get();$settings->update(['is_api_enabled' => true]);return response()->json(['message' => 'API enabled.'], 200);@@ -135,7 +135,7 @@ class OtherController extends Controllerif ($teamId !== '0') {return response()->json(['message' => 'You are not allowed to disable the API.'], 403);}- $settings = view()->shared('instanceSettings');+ $settings = \App\Models\InstanceSettings::get();$settings->update(['is_api_enabled' => false]);return response()->json(['message' => 'API disabled.'], 200);diff --git a/app/Http/Controllers/Api/ServersController.php b/app/Http/Controllers/Api/ServersController.phpindex 870824e9a9..da9c3b2d86 100644--- a/app/Http/Controllers/Api/ServersController.php+++ b/app/Http/Controllers/Api/ServersController.php@@ -300,7 +300,7 @@ class ServersController extends Controller$projects = Project::where('team_id', $teamId)->get();$domains = collect();$applications = $projects->pluck('applications')->flatten();- $settings = view()->shared('instanceSettings');+ $settings = \App\Models\InstanceSettings::get();if ($applications->count() > 0) {foreach ($applications as $application) {$ip = $application->destination->server->ip;diff --git a/app/Http/Middleware/ApiAllowed.php b/app/Http/Middleware/ApiAllowed.phpindex 36ac6cb9cf..648720ba49 100644--- a/app/Http/Middleware/ApiAllowed.php+++ b/app/Http/Middleware/ApiAllowed.php@@ -14,7 +14,7 @@ class ApiAllowedif (isCloud()) {return $next($request);}- $settings = view()->shared('instanceSettings');+ $settings = \App\Models\InstanceSettings::get();if ($settings->is_api_enabled === false) {return response()->json(['success' => true, 'message' => 'API is disabled.'], 403);}diff --git a/app/Jobs/PullCoolifyImageJob.php b/app/Jobs/PullCoolifyImageJob.phpindex c8bb5f7ef4..253b0b9f03 100644--- a/app/Jobs/PullCoolifyImageJob.php+++ b/app/Jobs/PullCoolifyImageJob.php@@ -35,7 +35,7 @@ class PullCoolifyImageJob implements ShouldBeEncrypted, ShouldQueue$latest_version = get_latest_version_of_coolify();instant_remote_process(["docker pull -q ghcr.io/coollabsio/coolify:{$latest_version}"], $server, false);- $settings = view()->shared('instanceSettings');+ $settings = \App\Models\InstanceSettings::get();$current_version = config('version');if (! $settings->is_auto_update_enabled) {return;diff --git a/app/Livewire/Help.php b/app/Livewire/Help.phpindex 465332cb07..0289f5f36f 100644--- a/app/Livewire/Help.php+++ b/app/Livewire/Help.php@@ -47,7 +47,7 @@ class Help extends Component]);$mail->subject("[HELP]: {$this->subject}");- $settings = view()->shared('instanceSettings');+ $settings = \App\Models\InstanceSettings::get();$type = set_transanctional_email_settings($settings);if (! $type) {$url = 'https://app.coolify.io/api/feedback';diff --git a/app/Livewire/Notifications/Email.php b/app/Livewire/Notifications/Email.phpindex c694acf5d4..2960ed2261 100644--- a/app/Livewire/Notifications/Email.php+++ b/app/Livewire/Notifications/Email.php@@ -172,7 +172,7 @@ class Email extends Componentpublic function copyFromInstanceSettings(){- $settings = view()->shared('instanceSettings');+ $settings = \App\Models\InstanceSettings::get();if ($settings->smtp_enabled) {$team = currentTeam();$team->update([diff --git a/app/Livewire/Settings/Index.php b/app/Livewire/Settings/Index.phpindex 044f78016f..e71d2de00f 100644--- a/app/Livewire/Settings/Index.php+++ b/app/Livewire/Settings/Index.php@@ -18,7 +18,7 @@ class Index extends Componentpublic function mount(){if (isInstanceAdmin()) {- $settings = view()->shared('instanceSettings');+ $settings = \App\Models\InstanceSettings::get();$database = StandalonePostgresql::whereName('coolify-db')->first();$s3s = S3Storage::whereTeamId(0)->get() ?? [];if ($database) {diff --git a/app/Livewire/Settings/License.php b/app/Livewire/Settings/License.phpindex dce8e44778..f9402fd7b6 100644--- a/app/Livewire/Settings/License.php+++ b/app/Livewire/Settings/License.php@@ -29,7 +29,7 @@ class License extends Componentabort(404);}$this->instance_id = config('app.id');- $this->settings = view()->shared('instanceSettings');+ $this->settings = \App\Models\InstanceSettings::get();}public function render()diff --git a/app/Livewire/Source/Github/Change.php b/app/Livewire/Source/Github/Change.phpindex 09455e6a15..75d7fd04a7 100644--- a/app/Livewire/Source/Github/Change.php+++ b/app/Livewire/Source/Github/Change.php@@ -99,7 +99,7 @@ class Change extends Componentreturn redirect()->route('source.all');}$this->applications = $this->github_app->applications;- $settings = view()->shared('instanceSettings');+ $settings = \App\Models\InstanceSettings::get();$this->github_app->makeVisible('client_secret')->makeVisible('webhook_secret');$this->name = str($this->github_app->name)->kebab();diff --git a/app/Livewire/Subscription/Index.php b/app/Livewire/Subscription/Index.phpindex 365e6a3912..c278bf58ee 100644--- a/app/Livewire/Subscription/Index.php+++ b/app/Livewire/Subscription/Index.php@@ -23,7 +23,7 @@ class Index extends Componentif (data_get(currentTeam(), 'subscription') && isSubscriptionActive()) {return redirect()->route('subscription.show');}- $this->settings = view()->shared('instanceSettings');+ $this->settings = \App\Models\InstanceSettings::get();$this->alreadySubscribed = currentTeam()->subscription()->exists();}diff --git a/app/Models/Server.php b/app/Models/Server.phpindex 7ab04f05ef..e164f2e275 100644--- a/app/Models/Server.php+++ b/app/Models/Server.php@@ -318,7 +318,7 @@ respond 404public function setupDynamicProxyConfiguration(){- $settings = view()->shared('instanceSettings');+ $settings = \App\Models\InstanceSettings::get();$dynamic_config_path = $this->proxyPath().'/dynamic';if ($this->proxyType() === 'TRAEFIK_V2') {$file = "$dynamic_config_path/coolify.yaml";diff --git a/app/Notifications/Channels/TransactionalEmailChannel.php b/app/Notifications/Channels/TransactionalEmailChannel.phpindex 49bebd692c..549fc6cd32 100644--- a/app/Notifications/Channels/TransactionalEmailChannel.php+++ b/app/Notifications/Channels/TransactionalEmailChannel.php@@ -13,7 +13,7 @@ class TransactionalEmailChannel{public function send(User $notifiable, Notification $notification): void{- $settings = view()->shared('instanceSettings');+ $settings = \App\Models\InstanceSettings::get();if (! data_get($settings, 'smtp_enabled') && ! data_get($settings, 'resend_enabled')) {Log::info('SMTP/Resend not enabled');diff --git a/app/Notifications/TransactionalEmails/ResetPassword.php b/app/Notifications/TransactionalEmails/ResetPassword.phpindex fcb1ddb759..8988a43421 100644--- a/app/Notifications/TransactionalEmails/ResetPassword.php+++ b/app/Notifications/TransactionalEmails/ResetPassword.php@@ -18,7 +18,7 @@ class ResetPassword extends Notificationpublic function __construct($token){- $this->settings = view()->shared('instanceSettings');+ $this->settings = \App\Models\InstanceSettings::get();$this->token = $token;}diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.phpindex 7fb9d56e74..cd90918adb 100644--- a/app/Providers/AppServiceProvider.php+++ b/app/Providers/AppServiceProvider.php@@ -30,9 +30,9 @@ class AppServiceProvider extends ServiceProvider])->baseUrl($api_url);}});- if (! env('CI')) {- View::share('instanceSettings', InstanceSettings::get());- }+ // if (! env('CI')) {+ // View::share('instanceSettings', InstanceSettings::get());+ // }}}diff --git a/app/Providers/FortifyServiceProvider.php b/app/Providers/FortifyServiceProvider.phpindex bb5dc81f4d..9b0a81026b 100644--- a/app/Providers/FortifyServiceProvider.php+++ b/app/Providers/FortifyServiceProvider.php@@ -44,7 +44,7 @@ class FortifyServiceProvider extends ServiceProvider{Fortify::createUsersUsing(CreateNewUser::class);Fortify::registerView(function () {- $settings = view()->shared('instanceSettings');+ $settings = \App\Models\InstanceSettings::get();if (! $settings->is_registration_enabled) {return redirect()->route('login');}@@ -56,7 +56,7 @@ class FortifyServiceProvider extends ServiceProvider});Fortify::loginView(function () {- $settings = view()->shared('instanceSettings');+ $settings = \App\Models\InstanceSettings::get();$enabled_oauth_providers = OauthSetting::where('enabled', true)->get();$users = User::count();if ($users == 0) {diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.phpindex bc1299088e..4480c65f45 100644--- a/bootstrap/helpers/shared.php+++ b/bootstrap/helpers/shared.php@@ -244,13 +244,13 @@ function generate_application_name(string $git_repository, string $git_branch, ?function is_transactional_emails_active(): bool{- return isEmailEnabled(view()->shared('instanceSettings'));+ return isEmailEnabled(\App\Models\InstanceSettings::get());}function set_transanctional_email_settings(?InstanceSettings $settings = null): ?string{if (! $settings) {- $settings = view()->shared('instanceSettings');+ $settings = \App\Models\InstanceSettings::get();}config()->set('mail.from.address', data_get($settings, 'smtp_from_address'));config()->set('mail.from.name', data_get($settings, 'smtp_from_name'));@@ -284,7 +284,7 @@ function base_ip(): stringif (isDev()) {return 'localhost';}- $settings = view()->shared('instanceSettings');+ $settings = \App\Models\InstanceSettings::get();if ($settings->public_ipv4) {return "$settings->public_ipv4";}@@ -312,7 +312,7 @@ function getFqdnWithoutPort(string $fqdn)*/function base_url(bool $withPort = true): string{- $settings = view()->shared('instanceSettings');+ $settings = \App\Models\InstanceSettings::get();if ($settings->fqdn) {return $settings->fqdn;}@@ -379,7 +379,7 @@ function send_internal_notification(string $message): void}function send_user_an_email(MailMessage $mail, string $email, ?string $cc = null): void{- $settings = view()->shared('instanceSettings');+ $settings = \App\Models\InstanceSettings::get();$type = set_transanctional_email_settings($settings);if (! $type) {throw new Exception('No email settings found.');@@ -2258,7 +2258,7 @@ function validate_dns_entry(string $fqdn, Server $server)if (str($host)->contains('sslip.io')) {return true;}- $settings = view()->shared('instanceSettings');+ $settings = \App\Models\InstanceSettings::get();$is_dns_validation_enabled = data_get($settings, 'is_dns_validation_enabled');if (! $is_dns_validation_enabled) {return true;@@ -2378,7 +2378,7 @@ function checkIfDomainIsAlreadyUsed(Collection|array $domains, ?string $teamId =if ($domainFound) {return true;}- $settings = view()->shared('instanceSettings');+ $settings = \App\Models\InstanceSettings::get();if (data_get($settings, 'fqdn')) {$domain = data_get($settings, 'fqdn');if (str($domain)->endsWith('/')) {@@ -2450,7 +2450,7 @@ function check_domain_usage(ServiceApplication|Application|null $resource = null}}if ($resource) {- $settings = view()->shared('instanceSettings');+ $settings = \App\Models\InstanceSettings::get();if (data_get($settings, 'fqdn')) {$domain = data_get($settings, 'fqdn');if (str($domain)->endsWith('/')) {@@ -2525,7 +2525,7 @@ function get_public_ips(){try {echo "Refreshing public ips!\n";- $settings = view()->shared('instanceSettings');+ $settings = \App\Models\InstanceSettings::get();[$first, $second] = Process::concurrently(function (Pool $pool) {$pool->path(__DIR__)->command('curl -4s https://ifconfig.io');$pool->path(__DIR__)->command('curl -6s https://ifconfig.io');diff --git a/config/sentry.php b/config/sentry.phpindex 09cd71fc34..a99743717f 100644--- a/config/sentry.php+++ b/config/sentry.php@@ -7,7 +7,7 @@ return [// The release version of your application// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))- 'release' => '4.0.0-beta.312',+ 'release' => '4.0.0-beta.313',// When left empty or `null` the Laravel environment will be used'environment' => config('app.env'),diff --git a/config/version.php b/config/version.phpindex db7527f179..26791fd271 100644--- a/config/version.php+++ b/config/version.php@@ -1,3 +1,3 @@<?php-return '4.0.0-beta.312';+return '4.0.0-beta.313';diff --git a/database/seeders/InstanceSettingsSeeder.php b/database/seeders/InstanceSettingsSeeder.phpindex f4b4a7fa29..c3182a2dd6 100644--- a/database/seeders/InstanceSettingsSeeder.php+++ b/database/seeders/InstanceSettingsSeeder.php@@ -27,14 +27,14 @@ class InstanceSettingsSeeder extends Seeder$ipv4 = Process::run('curl -4s https://ifconfig.io')->output();$ipv4 = trim($ipv4);$ipv4 = filter_var($ipv4, FILTER_VALIDATE_IP);- $settings = view()->shared('instanceSettings');+ $settings = \App\Models\InstanceSettings::get();if (is_null($settings->public_ipv4) && $ipv4) {$settings->update(['public_ipv4' => $ipv4]);}$ipv6 = Process::run('curl -6s https://ifconfig.io')->output();$ipv6 = trim($ipv6);$ipv6 = filter_var($ipv6, FILTER_VALIDATE_IP);- $settings = view()->shared('instanceSettings');+ $settings = \App\Models\InstanceSettings::get();if (is_null($settings->public_ipv6) && $ipv6) {$settings->update(['public_ipv6' => $ipv6]);}diff --git a/resources/views/layouts/base.blade.php b/resources/views/layouts/base.blade.phpindex 9f31790903..0076c941a2 100644--- a/resources/views/layouts/base.blade.php+++ b/resources/views/layouts/base.blade.php@@ -8,7 +8,7 @@@use('App\Models\InstanceSettings')@php- $instanceSettings = view()->shared('instanceSettings');+ $instanceSettings = \App\Models\InstanceSettings::get();$name = null;if ($instanceSettings) {diff --git a/versions.json b/versions.jsonindex 4cc8314de7..78c113fbd1 100644--- a/versions.json+++ b/versions.json@@ -1,7 +1,7 @@{"coolify": {"v4": {- "version": "4.0.0-beta.312"+ "version": "4.0.0-beta.313"}}-}+}\ No newline at end of file