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
refactor(models): add fillable attributes for database configuration options
Andras Bacsaic0c034988039
diff --git a/app/Models/Service.php b/app/Models/Service.phpindex b3ff85e531..491924c497 100644--- a/app/Models/Service.php+++ b/app/Models/Service.php@@ -57,6 +57,7 @@ class Service extends BaseModel'service_type','config_hash','compose_parsing_version',+ 'is_container_label_escape_enabled',];protected $appends = ['server_status', 'status'];diff --git a/app/Models/StandaloneClickhouse.php b/app/Models/StandaloneClickhouse.phpindex c192e53601..c6d91dd553 100644--- a/app/Models/StandaloneClickhouse.php+++ b/app/Models/StandaloneClickhouse.php@@ -37,6 +37,9 @@ class StandaloneClickhouse extends BaseModel'last_restart_at','last_restart_type','last_online_at',+ 'public_port_timeout',+ 'custom_docker_run_options',+ 'clickhouse_db',];protected $appends = ['internal_db_url', 'external_db_url', 'database_type', 'server_status'];diff --git a/app/Models/StandaloneDragonfly.php b/app/Models/StandaloneDragonfly.phpindex 7cc74f0ce7..af309f9806 100644--- a/app/Models/StandaloneDragonfly.php+++ b/app/Models/StandaloneDragonfly.php@@ -36,6 +36,9 @@ class StandaloneDragonfly extends BaseModel'last_restart_at','last_restart_type','last_online_at',+ 'public_port_timeout',+ 'enable_ssl',+ 'custom_docker_run_options',];protected $appends = ['internal_db_url', 'external_db_url', 'database_type', 'server_status'];diff --git a/app/Models/StandaloneKeydb.php b/app/Models/StandaloneKeydb.phpindex 7a0d7f03d0..ee07b4783b 100644--- a/app/Models/StandaloneKeydb.php+++ b/app/Models/StandaloneKeydb.php@@ -37,6 +37,9 @@ class StandaloneKeydb extends BaseModel'last_restart_at','last_restart_type','last_online_at',+ 'public_port_timeout',+ 'enable_ssl',+ 'custom_docker_run_options',];protected $appends = ['internal_db_url', 'external_db_url', 'server_status'];diff --git a/app/Models/StandaloneMariadb.php b/app/Models/StandaloneMariadb.phpindex 6cac9e5f4e..ad5220496b 100644--- a/app/Models/StandaloneMariadb.php+++ b/app/Models/StandaloneMariadb.php@@ -39,6 +39,10 @@ class StandaloneMariadb extends BaseModel'last_restart_at','last_restart_type','last_online_at',+ 'public_port_timeout',+ 'enable_ssl',+ 'is_log_drain_enabled',+ 'custom_docker_run_options',];protected $appends = ['internal_db_url', 'external_db_url', 'database_type', 'server_status'];diff --git a/app/Models/StandaloneMongodb.php b/app/Models/StandaloneMongodb.phpindex 5ca4ef5d34..590c173e14 100644--- a/app/Models/StandaloneMongodb.php+++ b/app/Models/StandaloneMongodb.php@@ -37,6 +37,12 @@ class StandaloneMongodb extends BaseModel'last_restart_at','last_restart_type','last_online_at',+ 'public_port_timeout',+ 'enable_ssl',+ 'ssl_mode',+ 'is_log_drain_enabled',+ 'is_include_timestamps',+ 'custom_docker_run_options',];protected $appends = ['internal_db_url', 'external_db_url', 'database_type', 'server_status'];diff --git a/app/Models/StandaloneMysql.php b/app/Models/StandaloneMysql.phpindex cf8d78a9c6..d991617b74 100644--- a/app/Models/StandaloneMysql.php+++ b/app/Models/StandaloneMysql.php@@ -38,6 +38,12 @@ class StandaloneMysql extends BaseModel'last_restart_at','last_restart_type','last_online_at',+ 'public_port_timeout',+ 'enable_ssl',+ 'ssl_mode',+ 'is_log_drain_enabled',+ 'is_include_timestamps',+ 'custom_docker_run_options',];protected $appends = ['internal_db_url', 'external_db_url', 'database_type', 'server_status'];diff --git a/app/Models/StandalonePostgresql.php b/app/Models/StandalonePostgresql.phpindex 7db334c5d1..71034427f5 100644--- a/app/Models/StandalonePostgresql.php+++ b/app/Models/StandalonePostgresql.php@@ -40,6 +40,12 @@ class StandalonePostgresql extends BaseModel'last_restart_at','last_restart_type','last_online_at',+ 'public_port_timeout',+ 'enable_ssl',+ 'ssl_mode',+ 'is_log_drain_enabled',+ 'is_include_timestamps',+ 'custom_docker_run_options',];protected $appends = ['internal_db_url', 'external_db_url', 'database_type', 'server_status'];diff --git a/app/Models/StandaloneRedis.php b/app/Models/StandaloneRedis.phpindex 2320619cff..4eb28e0385 100644--- a/app/Models/StandaloneRedis.php+++ b/app/Models/StandaloneRedis.php@@ -34,6 +34,11 @@ class StandaloneRedis extends BaseModel'last_restart_at','last_restart_type','last_online_at',+ 'public_port_timeout',+ 'enable_ssl',+ 'is_log_drain_enabled',+ 'is_include_timestamps',+ 'custom_docker_run_options',];protected $appends = ['internal_db_url', 'external_db_url', 'database_type', 'server_status'];diff --git a/tests/Feature/MassAssignmentProtectionTest.php b/tests/Feature/MassAssignmentProtectionTest.phpindex 18de67ce74..436d0736b0 100644--- a/tests/Feature/MassAssignmentProtectionTest.php+++ b/tests/Feature/MassAssignmentProtectionTest.php@@ -168,6 +168,58 @@ describe('mass assignment protection', function () {expect($model->isFillable('mongo_initdb_root_username'))->toBeTrue();});+ test('standalone database models allow mass assignment of public_port_timeout', function () {+ $models = [+ StandalonePostgresql::class,+ StandaloneRedis::class,+ StandaloneMysql::class,+ StandaloneMariadb::class,+ StandaloneMongodb::class,+ StandaloneKeydb::class,+ StandaloneDragonfly::class,+ StandaloneClickhouse::class,+ ];++ foreach ($models as $modelClass) {+ $model = new $modelClass;+ expect($model->isFillable('public_port_timeout'))+ ->toBeTrue("{$modelClass} should allow mass assignment of 'public_port_timeout'");+ }+ });++ test('standalone database models allow mass assignment of SSL fields where applicable', function () {+ $sslModels = [+ StandalonePostgresql::class,+ StandaloneMysql::class,+ StandaloneMariadb::class,+ StandaloneMongodb::class,+ StandaloneRedis::class,+ StandaloneKeydb::class,+ StandaloneDragonfly::class,+ ];++ foreach ($sslModels as $modelClass) {+ $model = new $modelClass;+ expect($model->isFillable('enable_ssl'))+ ->toBeTrue("{$modelClass} should allow mass assignment of 'enable_ssl'");+ }++ // Clickhouse has no SSL columns+ expect((new StandaloneClickhouse)->isFillable('enable_ssl'))->toBeFalse();++ $sslModeModels = [+ StandalonePostgresql::class,+ StandaloneMysql::class,+ StandaloneMongodb::class,+ ];++ foreach ($sslModeModels as $modelClass) {+ $model = new $modelClass;+ expect($model->isFillable('ssl_mode'))+ ->toBeTrue("{$modelClass} should allow mass assignment of 'ssl_mode'");+ }+ });+test('Application fill ignores non-fillable fields', function () {$application = new Application;$application->fill([