fix instanceSettings
This commit is contained in:
parent
ab6d361e64
commit
4156ba8908
@ -23,7 +23,7 @@ class CreateNewUser implements CreatesNewUsers
|
|||||||
*/
|
*/
|
||||||
public function create(array $input): User
|
public function create(array $input): User
|
||||||
{
|
{
|
||||||
$settings = InstanceSettings::find(0);
|
$settings = InstanceSettings::get();
|
||||||
if (!$settings->is_registration_enabled) {
|
if (!$settings->is_registration_enabled) {
|
||||||
Log::info('Registration is disabled');
|
Log::info('Registration is disabled');
|
||||||
abort(403);
|
abort(403);
|
||||||
|
@ -63,7 +63,7 @@ class InstallProxy
|
|||||||
|
|
||||||
protected function getEnvContents()
|
protected function getEnvContents()
|
||||||
{
|
{
|
||||||
$instance_fqdn = InstanceSettings::find(1)->fqdn ?? config('app.url');
|
$instance_fqdn = InstanceSettings::get()->fqdn ?? config('app.url');
|
||||||
$url = Url::fromString($instance_fqdn);
|
$url = Url::fromString($instance_fqdn);
|
||||||
$data = [
|
$data = [
|
||||||
'TRAEFIK_DASHBOARD_HOST' => $url->getHost(),
|
'TRAEFIK_DASHBOARD_HOST' => $url->getHost(),
|
||||||
|
@ -48,7 +48,7 @@ class Change extends Component
|
|||||||
}
|
}
|
||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
$settings = InstanceSettings::first();
|
$settings = InstanceSettings::get();
|
||||||
if ($settings->fqdn) {
|
if ($settings->fqdn) {
|
||||||
$this->host = $settings->fqdn;
|
$this->host = $settings->fqdn;
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ class DeployApplicationJob implements ShouldQueue
|
|||||||
public string $application_uuid,
|
public string $application_uuid,
|
||||||
public bool $force_rebuild = false,
|
public bool $force_rebuild = false,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
$this->application = Application::query()
|
$this->application = Application::query()
|
||||||
->where('uuid', $this->application_uuid)
|
->where('uuid', $this->application_uuid)
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
@ -100,8 +101,7 @@ class DeployApplicationJob implements ShouldQueue
|
|||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$coolify_instance_settings = InstanceSettings::find(0);
|
$coolify_instance_settings = InstanceSettings::get();
|
||||||
$deployment_type = $this->application->deploymentType();
|
|
||||||
if ($this->application->deploymentType() === 'source') {
|
if ($this->application->deploymentType() === 'source') {
|
||||||
$this->source = $this->application->source->getMorphClass()::where('id', $this->application->source->id)->first();
|
$this->source = $this->application->source->getMorphClass()::where('id', $this->application->source->id)->first();
|
||||||
}
|
}
|
||||||
|
@ -48,8 +48,6 @@ class Application extends BaseModel
|
|||||||
{
|
{
|
||||||
return $this->previews->modelScope();
|
return $this->previews->modelScope();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function publishDirectory(): Attribute
|
public function publishDirectory(): Attribute
|
||||||
{
|
{
|
||||||
return Attribute::make(
|
return Attribute::make(
|
||||||
|
@ -6,4 +6,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
|
|
||||||
class InstanceSettings extends Model
|
class InstanceSettings extends Model
|
||||||
{
|
{
|
||||||
|
public static function get()
|
||||||
|
{
|
||||||
|
return InstanceSettings::findOrFail(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ class FortifyServiceProvider extends ServiceProvider
|
|||||||
public function boot(): void
|
public function boot(): void
|
||||||
{
|
{
|
||||||
Fortify::registerView(function () {
|
Fortify::registerView(function () {
|
||||||
$settings = InstanceSettings::find(0);
|
$settings = InstanceSettings::get();
|
||||||
if (!$settings->is_registration_enabled) {
|
if (!$settings->is_registration_enabled) {
|
||||||
return redirect()->route('login');
|
return redirect()->route('login');
|
||||||
}
|
}
|
||||||
@ -39,7 +39,7 @@ class FortifyServiceProvider extends ServiceProvider
|
|||||||
});
|
});
|
||||||
|
|
||||||
Fortify::loginView(function () {
|
Fortify::loginView(function () {
|
||||||
$settings = InstanceSettings::find(0);
|
$settings = InstanceSettings::get();
|
||||||
return view('auth.login', [
|
return view('auth.login', [
|
||||||
'is_registration_enabled' => $settings->is_registration_enabled
|
'is_registration_enabled' => $settings->is_registration_enabled
|
||||||
]);
|
]);
|
||||||
|
@ -135,7 +135,7 @@ Route::middleware(['auth'])->group(function () {
|
|||||||
Route::get('/settings', function () {
|
Route::get('/settings', function () {
|
||||||
$isRoot = auth()->user()->isRoot();
|
$isRoot = auth()->user()->isRoot();
|
||||||
if ($isRoot) {
|
if ($isRoot) {
|
||||||
$settings = InstanceSettings::find(0);
|
$settings = InstanceSettings::get();
|
||||||
return view('settings', [
|
return view('settings', [
|
||||||
'settings' => $settings
|
'settings' => $settings
|
||||||
]);
|
]);
|
||||||
@ -165,7 +165,7 @@ Route::middleware(['auth'])->group(function () {
|
|||||||
$private_key = PrivateKey::where('uuid', request()->private_key_uuid)->first();
|
$private_key = PrivateKey::where('uuid', request()->private_key_uuid)->first();
|
||||||
return view('private-key.show', [
|
return view('private-key.show', [
|
||||||
'private_key' => $private_key,
|
'private_key' => $private_key,
|
||||||
]);
|
]);G
|
||||||
})->name('private-key.show');
|
})->name('private-key.show');
|
||||||
});
|
});
|
||||||
Route::middleware(['auth'])->group(function () {
|
Route::middleware(['auth'])->group(function () {
|
||||||
@ -173,7 +173,7 @@ Route::middleware(['auth'])->group(function () {
|
|||||||
Route::get('/source/github/{github_app_uuid}', function (Request $request) {
|
Route::get('/source/github/{github_app_uuid}', function (Request $request) {
|
||||||
$github_app = GithubApp::where('uuid', request()->github_app_uuid)->first();
|
$github_app = GithubApp::where('uuid', request()->github_app_uuid)->first();
|
||||||
$name = Str::of(Str::kebab($github_app->name))->start('coolify-');
|
$name = Str::of(Str::kebab($github_app->name))->start('coolify-');
|
||||||
$settings = InstanceSettings::first();
|
$settings = InstanceSettings::get();
|
||||||
$host = $request->schemeAndHttpHost();
|
$host = $request->schemeAndHttpHost();
|
||||||
if ($settings->fqdn) {
|
if ($settings->fqdn) {
|
||||||
$host = $settings->fqdn;
|
$host = $settings->fqdn;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user