fix: settings for apps and projects

add: coolify version config
fix: private key for private git based apps
This commit is contained in:
Andras Bacsai
2023-03-30 11:09:39 +02:00
parent 90424d9847
commit 3b191fa73e
11 changed files with 62 additions and 25 deletions

View File

@@ -7,6 +7,15 @@ use Spatie\Activitylog\Models\Activity;
class Application extends BaseModel
{
protected static function booted()
{
static::created(function ($application) {
ApplicationSetting::create([
'application_id' => $application->id,
]);
});
}
public function environment()
{
return $this->belongsTo(Environment::class);

View File

@@ -6,4 +6,8 @@ use Illuminate\Database\Eloquent\Model;
class ApplicationSetting extends Model
{
public function application()
{
return $this->belongsTo(Application::class);
}
}

View File

@@ -8,4 +8,8 @@ class GithubApp extends BaseModel
{
return $this->morphMany(Application::class, 'source');
}
public function privateKey()
{
return $this->belongsTo(PrivateKey::class);
}
}

View File

@@ -4,4 +4,8 @@ namespace App\Models;
class GitlabApp extends BaseModel
{
public function privateKey()
{
return $this->belongsTo(PrivateKey::class);
}
}

View File

@@ -4,6 +4,14 @@ namespace App\Models;
class Project extends BaseModel
{
protected static function booted()
{
static::created(function ($project) {
ProjectSetting::create([
'project_id' => $project->id,
]);
});
}
public function environments() {
return $this->hasMany(Environment::class);
}

View File

@@ -21,9 +21,11 @@ class AppServiceProvider extends ServiceProvider
*/
public function boot(): void
{
// @TODO: Should remove builder container here
// Queue::after(function (JobProcessed $event) {
// dd($event->job->resolveName());
// });
Queue::after(function (JobProcessed $event) {
// @TODO: Remove `coolify-builder` container after the remoteProcess job is finishged and remoteProcess->type == `deployment`.
if ($event->job->resolveName() === 'App\Jobs\ExecuteRemoteProcess') {
}
});
}
}