fix: incorrect MongoDB init API property
This commit is contained in:
		| @@ -211,7 +211,7 @@ class DatabasesController extends Controller | ||||
|                         'mongo_conf' => ['type' => 'string', 'description' => 'Mongo conf'], | ||||
|                         'mongo_initdb_root_username' => ['type' => 'string', 'description' => 'Mongo initdb root username'], | ||||
|                         'mongo_initdb_root_password' => ['type' => 'string', 'description' => 'Mongo initdb root password'], | ||||
|                         'mongo_initdb_init_database' => ['type' => 'string', 'description' => 'Mongo initdb init database'], | ||||
|                         'mongo_initdb_database' => ['type' => 'string', 'description' => 'Mongo initdb init database'], | ||||
|                         'mysql_root_password' => ['type' => 'string', 'description' => 'MySQL root password'], | ||||
|                         'mysql_password' => ['type' => 'string', 'description' => 'MySQL password'], | ||||
|                         'mysql_user' => ['type' => 'string', 'description' => 'MySQL user'], | ||||
| @@ -242,7 +242,7 @@ class DatabasesController extends Controller | ||||
|     )] | ||||
|     public function update_by_uuid(Request $request) | ||||
|     { | ||||
|         $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'postgres_user', 'postgres_password', 'postgres_db', 'postgres_initdb_args', 'postgres_host_auth_method', 'postgres_conf', 'clickhouse_admin_user', 'clickhouse_admin_password', 'dragonfly_password', 'redis_password', 'redis_conf', 'keydb_password', 'keydb_conf', 'mariadb_conf', 'mariadb_root_password', 'mariadb_user', 'mariadb_password', 'mariadb_database', 'mongo_conf', 'mongo_initdb_root_username', 'mongo_initdb_root_password', 'mongo_initdb_init_database', 'mysql_root_password', 'mysql_user', 'mysql_database', 'mysql_conf']; | ||||
|         $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'postgres_user', 'postgres_password', 'postgres_db', 'postgres_initdb_args', 'postgres_host_auth_method', 'postgres_conf', 'clickhouse_admin_user', 'clickhouse_admin_password', 'dragonfly_password', 'redis_password', 'redis_conf', 'keydb_password', 'keydb_conf', 'mariadb_conf', 'mariadb_root_password', 'mariadb_user', 'mariadb_password', 'mariadb_database', 'mongo_conf', 'mongo_initdb_root_username', 'mongo_initdb_root_password', 'mongo_initdb_database', 'mysql_root_password', 'mysql_password', 'mysql_user', 'mysql_database', 'mysql_conf']; | ||||
|         $teamId = getTeamIdFromToken(); | ||||
|         if (is_null($teamId)) { | ||||
|             return invalidTokenResponse(); | ||||
| @@ -414,12 +414,12 @@ class DatabasesController extends Controller | ||||
|                 } | ||||
|                 break; | ||||
|             case 'standalone-mongodb': | ||||
|                 $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'mongo_conf', 'mongo_initdb_root_username', 'mongo_initdb_root_password', 'mongo_initdb_init_database']; | ||||
|                 $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'mongo_conf', 'mongo_initdb_root_username', 'mongo_initdb_root_password', 'mongo_initdb_database']; | ||||
|                 $validator = customApiValidator($request->all(), [ | ||||
|                     'mongo_conf' => 'string', | ||||
|                     'mongo_initdb_root_username' => 'string', | ||||
|                     'mongo_initdb_root_password' => 'string', | ||||
|                     'mongo_initdb_init_database' => 'string', | ||||
|                     'mongo_initdb_database' => 'string', | ||||
|                 ]); | ||||
|                 if ($request->has('mongo_conf')) { | ||||
|                     if (! isBase64Encoded($request->mongo_conf)) { | ||||
| @@ -1016,7 +1016,7 @@ class DatabasesController extends Controller | ||||
| 
 | ||||
|     public function create_database(Request $request, NewDatabaseTypes $type) | ||||
|     { | ||||
|         $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'postgres_user', 'postgres_password', 'postgres_db', 'postgres_initdb_args', 'postgres_host_auth_method', 'postgres_conf', 'clickhouse_admin_user', 'clickhouse_admin_password', 'dragonfly_password', 'redis_password', 'redis_conf', 'keydb_password', 'keydb_conf', 'mariadb_conf', 'mariadb_root_password', 'mariadb_user', 'mariadb_password', 'mariadb_database', 'mongo_conf', 'mongo_initdb_root_username', 'mongo_initdb_root_password', 'mongo_initdb_init_database', 'mysql_root_password', 'mysql_password', 'mysql_user', 'mysql_database', 'mysql_conf']; | ||||
|         $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'postgres_user', 'postgres_password', 'postgres_db', 'postgres_initdb_args', 'postgres_host_auth_method', 'postgres_conf', 'clickhouse_admin_user', 'clickhouse_admin_password', 'dragonfly_password', 'redis_password', 'redis_conf', 'keydb_password', 'keydb_conf', 'mariadb_conf', 'mariadb_root_password', 'mariadb_user', 'mariadb_password', 'mariadb_database', 'mongo_conf', 'mongo_initdb_root_username', 'mongo_initdb_root_password', 'mongo_initdb_database', 'mysql_root_password', 'mysql_password', 'mysql_user', 'mysql_database', 'mysql_conf']; | ||||
| 
 | ||||
|         $teamId = getTeamIdFromToken(); | ||||
|         if (is_null($teamId)) { | ||||
| @@ -1460,12 +1460,12 @@ class DatabasesController extends Controller | ||||
| 
 | ||||
|             return response()->json(serializeApiResponse($payload))->setStatusCode(201); | ||||
|         } elseif ($type === NewDatabaseTypes::MONGODB) { | ||||
|             $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'mongo_conf', 'mongo_initdb_root_username', 'mongo_initdb_root_password', 'mongo_initdb_init_database']; | ||||
|             $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'mongo_conf', 'mongo_initdb_root_username', 'mongo_initdb_root_password', 'mongo_initdb_database']; | ||||
|             $validator = customApiValidator($request->all(), [ | ||||
|                 'mongo_conf' => 'string', | ||||
|                 'mongo_initdb_root_username' => 'string', | ||||
|                 'mongo_initdb_root_password' => 'string', | ||||
|                 'mongo_initdb_init_database' => 'string', | ||||
|                 'mongo_initdb_database' => 'string', | ||||
|             ]); | ||||
|             $extraFields = array_diff(array_keys($request->all()), $allowedFields); | ||||
|             if ($validator->fails() || ! empty($extraFields)) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 SierraJC
					SierraJC