api api api api

This commit is contained in:
Andras Bacsai 2024-07-04 13:45:06 +02:00
parent 5e55c799ec
commit efa2ae5177
7 changed files with 316 additions and 83 deletions

View File

@ -6,7 +6,6 @@
use App\Actions\Application\StopApplication;
use App\Actions\Service\StartService;
use App\Enums\BuildPackTypes;
use App\Enums\NewResourceTypes;
use App\Http\Controllers\Controller;
use App\Jobs\DeleteResourceJob;
use App\Models\Application;
@ -26,6 +25,9 @@ class ApplicationsController extends Controller
private function removeSensitiveData($application)
{
$token = auth()->user()->currentAccessToken();
$application->makeHidden([
'id',
]);
if ($token->can('view:sensitive')) {
return serializeApiResponse($application);
}
@ -39,6 +41,8 @@ private function removeSensitiveData($application)
'manual_webhook_secret_github',
'manual_webhook_secret_gitlab',
'private_key_id',
'value',
'real_value',
]);
return serializeApiResponse($application);
@ -61,7 +65,37 @@ public function applications(Request $request)
return response()->json($applications);
}
public function create_application(Request $request)
public function create_public_application(Request $request)
{
$this->create_application($request, 'public');
}
public function create_private_gh_app_application(Request $request)
{
$this->create_application($request, 'private-gh-app');
}
public function create_private_deploy_key_application(Request $request)
{
$this->create_application($request, 'private-deploy-key');
}
public function create_dockerfile_application(Request $request)
{
$this->create_application($request, 'dockerfile');
}
public function create_dockerimage_application(Request $request)
{
$this->create_application($request, 'docker-image');
}
public function create_dockercompose_application(Request $request)
{
$this->create_application($request, 'dockercompose');
}
private function create_application(Request $request, $type)
{
$allowedFields = ['project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'type', 'name', 'description', 'is_static', 'domains', 'git_repository', 'git_branch', 'git_commit_sha', 'docker_registry_image_name', 'docker_registry_image_tag', 'build_pack', 'install_command', 'build_command', 'start_command', 'ports_exposes', 'ports_mappings', 'base_directory', 'publish_directory', 'health_check_enabled', 'health_check_path', 'health_check_port', 'health_check_host', 'health_check_method', 'health_check_return_code', 'health_check_scheme', 'health_check_response_text', 'health_check_interval', 'health_check_timeout', 'health_check_retries', 'health_check_start_period', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'custom_labels', 'custom_docker_run_options', 'post_deployment_command', 'post_deployment_command_container', 'pre_deployment_command', 'pre_deployment_command_container', 'manual_webhook_secret_github', 'manual_webhook_secret_gitlab', 'manual_webhook_secret_bitbucket', 'manual_webhook_secret_gitea', 'redirect', 'github_app_uuid', 'instant_deploy', 'dockerfile', 'docker_compose_location', 'docker_compose', 'docker_compose_raw', 'docker_compose_custom_start_command', 'docker_compose_custom_build_command', 'docker_compose_domains', 'watch_paths'];
$teamId = getTeamIdFromToken();
@ -80,7 +114,6 @@ public function create_application(Request $request)
'environment_name' => 'string|required',
'server_uuid' => 'string|required',
'destination_uuid' => 'string',
'type' => ['required', Rule::enum(NewResourceTypes::class)],
]);
$extraFields = array_diff(array_keys($request->all()), $allowedFields);
@ -100,7 +133,6 @@ public function create_application(Request $request)
$serverUuid = $request->server_uuid;
$fqdn = $request->domains;
$type = $request->type;
$instantDeploy = $request->instant_deploy;
$githubAppUuid = $request->github_app_uuid;
@ -196,8 +228,6 @@ public function create_application(Request $request)
return response()->json(serializeApiResponse([
'uuid' => data_get($application, 'uuid'),
'name' => data_get($application, 'name'),
'description' => data_get($application, 'description'),
'domains' => data_get($application, 'domains'),
]));
} elseif ($type === 'private-gh-app') {
@ -290,8 +320,6 @@ public function create_application(Request $request)
return response()->json(serializeApiResponse([
'uuid' => data_get($application, 'uuid'),
'name' => data_get($application, 'name'),
'description' => data_get($application, 'description'),
'domains' => data_get($application, 'domains'),
]));
} elseif ($type === 'private-deploy-key') {
@ -380,8 +408,6 @@ public function create_application(Request $request)
return response()->json(serializeApiResponse([
'uuid' => data_get($application, 'uuid'),
'name' => data_get($application, 'name'),
'description' => data_get($application, 'description'),
'domains' => data_get($application, 'domains'),
]));
} elseif ($type === 'dockerfile') {
@ -458,8 +484,6 @@ public function create_application(Request $request)
return response()->json(serializeApiResponse([
'uuid' => data_get($application, 'uuid'),
'name' => data_get($application, 'name'),
'description' => data_get($application, 'description'),
'domains' => data_get($application, 'domains'),
]));
} elseif ($type === 'docker-image') {
@ -516,8 +540,6 @@ public function create_application(Request $request)
return response()->json(serializeApiResponse([
'uuid' => data_get($application, 'uuid'),
'name' => data_get($application, 'name'),
'description' => data_get($application, 'description'),
'domains' => data_get($application, 'domains'),
]));
} elseif ($type === 'dockercompose') {
@ -596,8 +618,7 @@ public function create_application(Request $request)
return response()->json(serializeApiResponse([
'uuid' => data_get($service, 'uuid'),
'name' => data_get($service, 'name'),
'description' => data_get($service, 'description'),
'domains' => data_get($service, 'domains'),
]));
}
@ -761,7 +782,7 @@ public function update_by_uuid(Request $request)
return response()->json($this->removeSensitiveData($application));
}
public function envs_by_uuid(Request $request)
public function envs(Request $request)
{
$teamId = getTeamIdFromToken();
if (is_null($teamId)) {
@ -776,7 +797,24 @@ public function envs_by_uuid(Request $request)
}
$envs = $application->environment_variables->sortBy('id')->merge($application->environment_variables_preview->sortBy('id'));
return response()->json(serializeApiResponse($envs));
$envs = $envs->map(function ($env) {
$env->makeHidden([
'service_id',
'standalone_clickhouse_id',
'standalone_dragonfly_id',
'standalone_keydb_id',
'standalone_mariadb_id',
'standalone_mongodb_id',
'standalone_mysql_id',
'standalone_postgresql_id',
'standalone_redis_id',
]);
$env = $this->removeSensitiveData($env);
return $env;
});
return response()->json($envs);
}
public function update_env_by_uuid(Request $request)
@ -805,6 +843,8 @@ public function update_env_by_uuid(Request $request)
'is_preview' => 'boolean',
'is_build_time' => 'boolean',
'is_literal' => 'boolean',
'is_multiline' => 'boolean',
'is_shown_once' => 'boolean',
]);
$extraFields = array_diff(array_keys($request->all()), $allowedFields);
@ -837,9 +877,15 @@ public function update_env_by_uuid(Request $request)
if ($env->is_preview != $is_preview) {
$env->is_preview = $is_preview;
}
if ($env->is_multiline != $request->is_multiline) {
$env->is_multiline = $request->is_multiline;
}
if ($env->is_shown_once != $request->is_shown_once) {
$env->is_shown_once = $request->is_shown_once;
}
$env->save();
return response()->json(serializeApiResponse($env));
return response()->json($this->removeSensitiveData($env));
} else {
return response()->json([
'message' => 'Environment variable not found.',
@ -858,9 +904,15 @@ public function update_env_by_uuid(Request $request)
if ($env->is_preview != $is_preview) {
$env->is_preview = $is_preview;
}
if ($env->is_multiline != $request->is_multiline) {
$env->is_multiline = $request->is_multiline;
}
if ($env->is_shown_once != $request->is_shown_once) {
$env->is_shown_once = $request->is_shown_once;
}
$env->save();
return response()->json(serializeApiResponse($env));
return response()->json($this->removeSensitiveData($env));
} else {
return response()->json([
@ -912,6 +964,8 @@ public function create_bulk_envs(Request $request)
'is_preview' => 'boolean',
'is_build_time' => 'boolean',
'is_literal' => 'boolean',
'is_multiline' => 'boolean',
'is_shown_once' => 'boolean',
]);
if ($validator->fails()) {
return response()->json([
@ -922,6 +976,8 @@ public function create_bulk_envs(Request $request)
$is_preview = $item->get('is_preview') ?? false;
$is_build_time = $item->get('is_build_time') ?? false;
$is_literal = $item->get('is_literal') ?? false;
$is_multi_line = $item->get('is_multiline') ?? false;
$is_shown_once = $item->get('is_shown_once') ?? false;
if ($is_preview) {
$env = $application->environment_variables_preview->where('key', $item->get('key'))->first();
if ($env) {
@ -932,6 +988,12 @@ public function create_bulk_envs(Request $request)
if ($env->is_literal != $is_literal) {
$env->is_literal = $is_literal;
}
if ($env->is_multiline != $item->get('is_multiline')) {
$env->is_multiline = $item->get('is_multiline');
}
if ($env->is_shown_once != $item->get('is_shown_once')) {
$env->is_shown_once = $item->get('is_shown_once');
}
$env->save();
} else {
$env = $application->environment_variables()->create([
@ -940,6 +1002,8 @@ public function create_bulk_envs(Request $request)
'is_preview' => $is_preview,
'is_build_time' => $is_build_time,
'is_literal' => $is_literal,
'is_multiline' => $is_multi_line,
'is_shown_once' => $is_shown_once,
]);
}
} else {
@ -952,6 +1016,12 @@ public function create_bulk_envs(Request $request)
if ($env->is_literal != $is_literal) {
$env->is_literal = $is_literal;
}
if ($env->is_multiline != $item->get('is_multiline')) {
$env->is_multiline = $item->get('is_multiline');
}
if ($env->is_shown_once != $item->get('is_shown_once')) {
$env->is_shown_once = $item->get('is_shown_once');
}
$env->save();
} else {
$env = $application->environment_variables()->create([
@ -960,12 +1030,14 @@ public function create_bulk_envs(Request $request)
'is_preview' => $is_preview,
'is_build_time' => $is_build_time,
'is_literal' => $is_literal,
'is_multiline' => $is_multi_line,
'is_shown_once' => $is_shown_once,
]);
}
}
}
return response()->json(serializeApiResponse($env));
return response()->json($this->removeSensitiveData($env));
}
public function create_env(Request $request)
@ -989,6 +1061,8 @@ public function create_env(Request $request)
'is_preview' => 'boolean',
'is_build_time' => 'boolean',
'is_literal' => 'boolean',
'is_multiline' => 'boolean',
'is_shown_once' => 'boolean',
]);
$extraFields = array_diff(array_keys($request->all()), $allowedFields);
@ -1019,9 +1093,11 @@ public function create_env(Request $request)
'is_preview' => $request->is_preview ?? false,
'is_build_time' => $request->is_build_time ?? false,
'is_literal' => $request->is_literal ?? false,
'is_multiline' => $request->is_multiline ?? false,
'is_shown_once' => $request->is_shown_once ?? false,
]);
return response()->json(serializeApiResponse($env))->setStatusCode(201);
return response()->json($this->removeSensitiveData($env))->setStatusCode(201);
}
} else {
$env = $application->environment_variables->where('key', $request->key)->first();
@ -1036,9 +1112,11 @@ public function create_env(Request $request)
'is_preview' => $request->is_preview ?? false,
'is_build_time' => $request->is_build_time ?? false,
'is_literal' => $request->is_literal ?? false,
'is_multiline' => $request->is_multiline ?? false,
'is_shown_once' => $request->is_shown_once ?? false,
]);
return response()->json(serializeApiResponse($env))->setStatusCode(201);
return response()->json($this->removeSensitiveData($env))->setStatusCode(201);
}
}
@ -1105,11 +1183,9 @@ public function action_deploy(Request $request)
return response()->json(
[
'message' => 'Deployment request queued.',
'data' => [
'deployment_uuid' => $deployment_uuid->toString(),
'deployment_api_url' => base_url().'/api/v1/deployment/'.$deployment_uuid->toString(),
],
],
200
);
}
@ -1164,11 +1240,9 @@ public function action_restart(Request $request)
return response()->json(
[
'message' => 'Restart request queued.',
'data' => [
'deployment_uuid' => $deployment_uuid->toString(),
'deployment_api_url' => base_url().'/api/v1/deployment/'.$deployment_uuid->toString(),
],
],
);
}

View File

@ -19,6 +19,10 @@ class DatabasesController extends Controller
private function removeSensitiveData($database)
{
$token = auth()->user()->currentAccessToken();
$database->makeHidden([
'id',
'laravel_through_key',
]);
if ($token->can('view:sensitive')) {
return serializeApiResponse($database);
}
@ -151,6 +155,130 @@ public function update_by_uuid(Request $request)
}
}
if ($request->has('keydb_conf')) {
if (! isBase64Encoded($request->keydb_conf)) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
'keydb_conf' => 'The keydb_conf should be base64 encoded.',
],
], 422);
}
$keydbConf = base64_decode($request->keydb_conf);
if (mb_detect_encoding($keydbConf, 'ASCII', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
'keydb_conf' => 'The keydb_conf should be base64 encoded.',
],
], 422);
}
$request->offsetSet('keydb_conf', $keydbConf);
}
if ($request->has('mongo_conf')) {
if (! isBase64Encoded($request->mongo_conf)) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
'mongo_conf' => 'The mongo_conf should be base64 encoded.',
],
], 422);
}
$mongoConf = base64_decode($request->mongo_conf);
if (mb_detect_encoding($mongoConf, 'ASCII', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
'mongo_conf' => 'The mongo_conf should be base64 encoded.',
],
], 422);
}
$request->offsetSet('mongo_conf', $mongoConf);
}
if ($request->has('redis_conf')) {
if (! isBase64Encoded($request->redis_conf)) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
'redis_conf' => 'The redis_conf should be base64 encoded.',
],
], 422);
}
$redisConf = base64_decode($request->redis_conf);
if (mb_detect_encoding($redisConf, 'ASCII', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
'redis_conf' => 'The redis_conf should be base64 encoded.',
],
], 422);
}
$request->offsetSet('redis_conf', $redisConf);
}
if ($request->has('mysql_conf')) {
if (! isBase64Encoded($request->mysql_conf)) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
'mysql_conf' => 'The mysql_conf should be base64 encoded.',
],
], 422);
}
$mysqlConf = base64_decode($request->mysql_conf);
if (mb_detect_encoding($mysqlConf, 'ASCII', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
'mysql_conf' => 'The mysql_conf should be base64 encoded.',
],
], 422);
}
$request->offsetSet('mysql_conf', $mysqlConf);
}
if ($request->has('mariadb_conf')) {
if (! isBase64Encoded($request->mariadb_conf)) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
'mariadb_conf' => 'The mariadb_conf should be base64 encoded.',
],
], 422);
}
$mariadbConf = base64_decode($request->mariadb_conf);
if (mb_detect_encoding($mariadbConf, 'ASCII', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
'mariadb_conf' => 'The mariadb_conf should be base64 encoded.',
],
], 422);
}
$request->offsetSet('mariadb_conf', $mariadbConf);
}
if ($request->has('postgres_conf')) {
if (! isBase64Encoded($request->postgres_conf)) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
'postgres_conf' => 'The postgres_conf should be base64 encoded.',
],
], 422);
}
$postgresConf = base64_decode($request->postgres_conf);
if (mb_detect_encoding($postgresConf, 'ASCII', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
'postgres_conf' => 'The postgres_conf should be base64 encoded.',
],
], 422);
}
$request->offsetSet('postgres_conf', $postgresConf);
}
$whatToDoWithDatabaseProxy = null;
if ($request->is_public === false && $database->is_public === true) {
$whatToDoWithDatabaseProxy = 'stop';
@ -169,7 +297,6 @@ public function update_by_uuid(Request $request)
return response()->json([
'message' => 'Database updated.',
'data' => $this->removeSensitiveData($database),
]);
}
@ -308,10 +435,10 @@ public function create_database(Request $request)
}
}
return response()->json([
'message' => 'Database starting queued.',
'data' => serializeApiResponse($database),
]);
return response()->json(serializeApiResponse([
'uuid' => $database->uuid,
]))->setStatusCode(201);
} elseif ($request->type === NewDatabaseTypes::MARIADB->value) {
removeUnnecessaryFieldsFromRequest($request);
if ($request->has('mariadb_conf')) {
@ -342,10 +469,9 @@ public function create_database(Request $request)
}
}
return response()->json([
'message' => 'Database starting queued.',
'data' => serializeApiResponse($database),
]);
return response()->json(serializeApiResponse([
'uuid' => $database->uuid,
]))->setStatusCode(201);
} elseif ($request->type === NewDatabaseTypes::MYSQL->value) {
removeUnnecessaryFieldsFromRequest($request);
if ($request->has('mysql_conf')) {
@ -376,11 +502,9 @@ public function create_database(Request $request)
}
}
return response()->json([
'success' => true,
'message' => 'Database starting queued.',
'data' => serializeApiResponse($database),
]);
return response()->json(serializeApiResponse([
'uuid' => $database->uuid,
]))->setStatusCode(201);
} elseif ($request->type === NewDatabaseTypes::REDIS->value) {
removeUnnecessaryFieldsFromRequest($request);
if ($request->has('redis_conf')) {
@ -411,10 +535,9 @@ public function create_database(Request $request)
}
}
return response()->json([
'message' => 'Database starting queued.',
'data' => serializeApiResponse($database),
]);
return response()->json(serializeApiResponse([
'uuid' => $database->uuid,
]))->setStatusCode(201);
} elseif ($request->type === NewDatabaseTypes::DRAGONFLY->value) {
removeUnnecessaryFieldsFromRequest($request);
$database = create_standalone_dragonfly($environment->id, $destination->uuid, $request->all());
@ -425,10 +548,9 @@ public function create_database(Request $request)
}
}
return response()->json([
'message' => 'Database starting queued.',
'data' => serializeApiResponse($database),
]);
return response()->json(serializeApiResponse([
'uuid' => $database->uuid,
]))->setStatusCode(201);
} elseif ($request->type === NewDatabaseTypes::KEYDB->value) {
removeUnnecessaryFieldsFromRequest($request);
if ($request->has('keydb_conf')) {
@ -459,10 +581,9 @@ public function create_database(Request $request)
}
}
return response()->json([
'message' => 'Database starting queued.',
'data' => serializeApiResponse($database),
]);
return response()->json(serializeApiResponse([
'uuid' => $database->uuid,
]))->setStatusCode(201);
} elseif ($request->type === NewDatabaseTypes::CLICKHOUSE->value) {
removeUnnecessaryFieldsFromRequest($request);
$database = create_standalone_clickhouse($environment->id, $destination->uuid, $request->all());
@ -473,10 +594,9 @@ public function create_database(Request $request)
}
}
return response()->json([
'message' => 'Database starting queued.',
'data' => serializeApiResponse($database),
]);
return response()->json(serializeApiResponse([
'uuid' => $database->uuid,
]))->setStatusCode(201);
} elseif ($request->type === NewDatabaseTypes::MONGODB->value) {
removeUnnecessaryFieldsFromRequest($request);
if ($request->has('mongo_conf')) {
@ -507,10 +627,9 @@ public function create_database(Request $request)
}
}
return response()->json([
'message' => 'Database starting queued.',
'data' => serializeApiResponse($database),
]);
return response()->json(serializeApiResponse([
'uuid' => $database->uuid,
]))->setStatusCode(201);
}
return response()->json(['message' => 'Invalid database type requested.'], 400);

View File

@ -35,7 +35,9 @@ public function deployments(Request $request)
}
$servers = Server::whereTeamId($teamId)->get();
$deployments_per_server = ApplicationDeploymentQueue::whereIn('status', ['in_progress', 'queued'])->whereIn('server_id', $servers->pluck('id'))->get([
'id',
'deployment_uuid',
'commit',
'commit_message',
'application_id',
'application_name',
'deployment_url',
@ -43,9 +45,19 @@ public function deployments(Request $request)
'server_name',
'server_id',
'status',
])->sortBy('id')->toArray();
'is_api',
'is_webhook',
'restart_only',
'force_rebuild',
'rollback',
'created_at',
'updated_at',
])->sortBy('id');
$deployments_per_server = $deployments_per_server->map(function ($deployment) {
return $this->removeSensitiveData($deployment);
});
return response()->json(serializeApiResponse($deployments_per_server));
return response()->json($deployments_per_server);
}
public function deployment_by_uuid(Request $request)
@ -58,7 +70,26 @@ public function deployment_by_uuid(Request $request)
if (! $uuid) {
return response()->json(['message' => 'UUID is required.'], 400);
}
$deployment = ApplicationDeploymentQueue::where('deployment_uuid', $uuid)->first();
$deployment = ApplicationDeploymentQueue::where('deployment_uuid', $uuid)->first([
'deployment_uuid',
'commit',
'commit_message',
'application_id',
'application_name',
'deployment_url',
'pull_request_id',
'server_name',
'server_id',
'logs',
'status',
'is_api',
'is_webhook',
'restart_only',
'force_rebuild',
'rollback',
'created_at',
'updated_at',
]);
if (! $deployment) {
return response()->json(['message' => 'Deployment not found.'], 404);
}

View File

@ -28,6 +28,9 @@ private function removeSensitiveDataFromSettings($settings)
private function removeSensitiveData($server)
{
$token = auth()->user()->currentAccessToken();
$server->makeHidden([
'id',
]);
if ($token->can('view:sensitive')) {
return serializeApiResponse($server);
}

View File

@ -18,6 +18,9 @@ class ServicesController extends Controller
private function removeSensitiveData($service)
{
$token = auth()->user()->currentAccessToken();
$service->makeHidden([
'id',
]);
if ($token->can('view:sensitive')) {
return serializeApiResponse($service);
}
@ -45,7 +48,7 @@ public function services(Request $request)
$service = $this->removeSensitiveData($service);
}
return response()->json($services);
return response()->json($services->flatten());
}
public function create_service(Request $request)
@ -166,13 +169,8 @@ public function create_service(Request $request)
});
return response()->json([
'message' => 'Service created.',
'data' => $this->removeSensitiveData([
'id' => $service->id,
'uuid' => $service->uuid,
'name' => $service->name,
'domains' => $domains,
]),
]);
}

View File

@ -130,6 +130,12 @@ function sharedDataApplications()
'manual_webhook_secret_gitlab' => 'string|nullable',
'manual_webhook_secret_bitbucket' => 'string|nullable',
'manual_webhook_secret_gitea' => 'string|nullable',
'docker_compose_location' => 'string',
'docker_compose' => 'string|nullable',
'docker_compose_raw' => 'string|nullable',
'docker_compose_domains' => 'array|nullable',
'docker_compose_custom_start_command' => 'string|nullable',
'docker_compose_custom_build_command' => 'string|nullable',
];
}

View File

@ -103,20 +103,24 @@
Route::get('/resources', [ResourcesController::class, 'resources']);
Route::get('/applications', [ApplicationsController::class, 'applications']);
Route::post('/applications', [ApplicationsController::class, 'create_application'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::post('/applications/public', [ApplicationsController::class, 'create_public_application'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::post('/applications/private-github-app', [ApplicationsController::class, 'create_private_gh_app_application'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::post('/applications/private-deploy-key', [ApplicationsController::class, 'create_private_deploy_key_application'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::post('/applications/dockerfile', [ApplicationsController::class, 'create_dockerfile_application'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::post('/applications/dockerimage', [ApplicationsController::class, 'create_dockerimage_application'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::post('/applications/dockercompose', [ApplicationsController::class, 'create_dockercompose_application'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::get('/applications/{uuid}', [ApplicationsController::class, 'application_by_uuid']);
Route::patch('/applications/{uuid}', [ApplicationsController::class, 'update_by_uuid'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::delete('/applications/{uuid}', [ApplicationsController::class, 'delete_by_uuid'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::get('/applications/{uuid}/envs', [ApplicationsController::class, 'envs_by_uuid']);
Route::get('/applications/{uuid}/envs', [ApplicationsController::class, 'envs']);
Route::post('/applications/{uuid}/envs', [ApplicationsController::class, 'create_env'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::post('/applications/{uuid}/envs/bulk', [ApplicationsController::class, 'create_bulk_envs'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::patch('/applications/{uuid}/envs', [ApplicationsController::class, 'update_env_by_uuid']);
Route::delete('/applications/{uuid}/envs/{env_uuid}', [ApplicationsController::class, 'delete_env_by_uuid'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::match(['get', 'post'], '/applications/{uuid}/start', [ApplicationsController::class, 'action_deploy'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::match(['get', 'post'], '/applications/{uuid}/deploy', [ApplicationsController::class, 'action_deploy'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::match(['get', 'post'], '/applications/{uuid}/restart', [ApplicationsController::class, 'action_restart'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::match(['get', 'post'], '/applications/{uuid}/stop', [ApplicationsController::class, 'action_stop'])->middleware([IgnoreReadOnlyApiToken::class]);
@ -128,7 +132,6 @@
Route::delete('/databases/{uuid}', [DatabasesController::class, 'delete_by_uuid'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::match(['get', 'post'], '/databases/{uuid}/start', [DatabasesController::class, 'action_deploy'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::match(['get', 'post'], '/databases/{uuid}/deploy', [DatabasesController::class, 'action_deploy'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::match(['get', 'post'], '/databases/{uuid}/restart', [DatabasesController::class, 'action_restart'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::match(['get', 'post'], '/databases/{uuid}/stop', [DatabasesController::class, 'action_stop'])->middleware([IgnoreReadOnlyApiToken::class]);
@ -140,11 +143,10 @@
Route::delete('/services/{uuid}', [ServicesController::class, 'delete_by_uuid'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::match(['get', 'post'], '/services/{uuid}/start', [ServicesController::class, 'action_deploy'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::match(['get', 'post'], '/services/{uuid}/deploy', [ServicesController::class, 'action_deploy'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::match(['get', 'post'], '/services/{uuid}/restart', [ServicesController::class, 'action_restart'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::match(['get', 'post'], '/services/{uuid}/stop', [ServicesController::class, 'action_stop'])->middleware([IgnoreReadOnlyApiToken::class]);
Route::delete('/envs/{env_uuid}', [EnvironmentVariablesController::class, 'delete_env_by_uuid'])->middleware([IgnoreReadOnlyApiToken::class]);
// Route::delete('/envs/{env_uuid}', [EnvironmentVariablesController::class, 'delete_env_by_uuid'])->middleware([IgnoreReadOnlyApiToken::class]);
});