mirror of
https://github.com/tiennm99/coolify.git
synced 2026-06-22 23:35:39 +00:00
Add comment field support to environment variable API endpoints
API consumers can now create and update environment variables with an optional comment field for documentation purposes. Changes include: - Added comment validation (string, nullable, max 256 chars) to all env endpoints - Updated ApplicationsController create_env and update_env_by_uuid - Updated ServicesController create_env and update_env_by_uuid - Updated openapi.json request schemas to document the comment field 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2529,7 +2529,7 @@ class ApplicationsController extends Controller
|
||||
)]
|
||||
public function update_env_by_uuid(Request $request)
|
||||
{
|
||||
$allowedFields = ['key', 'value', 'is_preview', 'is_literal', 'is_multiline', 'is_shown_once', 'is_runtime', 'is_buildtime'];
|
||||
$allowedFields = ['key', 'value', 'is_preview', 'is_literal', 'is_multiline', 'is_shown_once', 'is_runtime', 'is_buildtime', 'comment'];
|
||||
$teamId = getTeamIdFromToken();
|
||||
|
||||
if (is_null($teamId)) {
|
||||
@@ -2559,6 +2559,7 @@ class ApplicationsController extends Controller
|
||||
'is_shown_once' => 'boolean',
|
||||
'is_runtime' => 'boolean',
|
||||
'is_buildtime' => 'boolean',
|
||||
'comment' => 'string|nullable|max:256',
|
||||
]);
|
||||
|
||||
$extraFields = array_diff(array_keys($request->all()), $allowedFields);
|
||||
@@ -2600,6 +2601,9 @@ class ApplicationsController extends Controller
|
||||
if ($request->has('is_buildtime') && $env->is_buildtime != $request->is_buildtime) {
|
||||
$env->is_buildtime = $request->is_buildtime;
|
||||
}
|
||||
if ($request->has('comment') && $env->comment != $request->comment) {
|
||||
$env->comment = $request->comment;
|
||||
}
|
||||
$env->save();
|
||||
|
||||
return response()->json($this->removeSensitiveData($env))->setStatusCode(201);
|
||||
@@ -2630,6 +2634,9 @@ class ApplicationsController extends Controller
|
||||
if ($request->has('is_buildtime') && $env->is_buildtime != $request->is_buildtime) {
|
||||
$env->is_buildtime = $request->is_buildtime;
|
||||
}
|
||||
if ($request->has('comment') && $env->comment != $request->comment) {
|
||||
$env->comment = $request->comment;
|
||||
}
|
||||
$env->save();
|
||||
|
||||
return response()->json($this->removeSensitiveData($env))->setStatusCode(201);
|
||||
@@ -2926,7 +2933,7 @@ class ApplicationsController extends Controller
|
||||
)]
|
||||
public function create_env(Request $request)
|
||||
{
|
||||
$allowedFields = ['key', 'value', 'is_preview', 'is_literal', 'is_multiline', 'is_shown_once', 'is_runtime', 'is_buildtime'];
|
||||
$allowedFields = ['key', 'value', 'is_preview', 'is_literal', 'is_multiline', 'is_shown_once', 'is_runtime', 'is_buildtime', 'comment'];
|
||||
$teamId = getTeamIdFromToken();
|
||||
|
||||
if (is_null($teamId)) {
|
||||
@@ -2951,6 +2958,7 @@ class ApplicationsController extends Controller
|
||||
'is_shown_once' => 'boolean',
|
||||
'is_runtime' => 'boolean',
|
||||
'is_buildtime' => 'boolean',
|
||||
'comment' => 'string|nullable|max:256',
|
||||
]);
|
||||
|
||||
$extraFields = array_diff(array_keys($request->all()), $allowedFields);
|
||||
@@ -2986,6 +2994,7 @@ class ApplicationsController extends Controller
|
||||
'is_shown_once' => $request->is_shown_once ?? false,
|
||||
'is_runtime' => $request->is_runtime ?? true,
|
||||
'is_buildtime' => $request->is_buildtime ?? true,
|
||||
'comment' => $request->comment ?? null,
|
||||
'resourceable_type' => get_class($application),
|
||||
'resourceable_id' => $application->id,
|
||||
]);
|
||||
@@ -3010,6 +3019,7 @@ class ApplicationsController extends Controller
|
||||
'is_shown_once' => $request->is_shown_once ?? false,
|
||||
'is_runtime' => $request->is_runtime ?? true,
|
||||
'is_buildtime' => $request->is_buildtime ?? true,
|
||||
'comment' => $request->comment ?? null,
|
||||
'resourceable_type' => get_class($application),
|
||||
'resourceable_id' => $application->id,
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user