Environment Variables API Documentation

Base Path

/envs

Endpoints

Get Environment Variables List

GET /

Query Parameters

{
  searchValue?: string  // Search keyword
}

Create Environment Variables

POST /

Request Body

[
  {
    name: string,     // Variable name (must start with letter or underscore, can only contain letters, numbers and underscores)
    value: string,    // Variable value
    remarks: string   // Remarks (optional)
  }
]

Update Environment Variable

PUT /

Request Body

{
  id: number,       // Environment variable ID
  name: string,     // Variable name
  value: string,    // Variable value
  remarks: string   // Remarks (optional)
}

Delete Environment Variables

DELETE /

Request Body

number[]  // Array of environment variable IDs

Move Environment Variable Position

PUT /:id/move

Request Body

{
  fromIndex: number,  // Original position
  toIndex: number     // Target position
}

Disable Environment Variables

PUT /disable

Request Body

number[]  // Array of environment variable IDs

Enable Environment Variables

PUT /enable

Request Body

number[]  // Array of environment variable IDs

Batch Update Variable Names

PUT /name

Request Body

{
  ids: number[],  // Array of environment variable IDs
  name: string    // New variable name
}

Get Single Environment Variable

GET /:id

Get details of specified environment variable ID.

Upload Environment Variables File

POST /upload

Request

  • Content-Type: multipart/form-data
  • Field: env (file)

File Format Requirements

  • JSON format
  • Each record must contain name and value fields

Error Handling

  • All endpoints follow unified error handling mechanism
  • Successful responses return { code: 200, data: ... }
  • Error logging is handled by Winston logger

Notes

  • Parameter validation using celebrate/Joi
  • Variable names must follow naming conventions
  • Supports batch operations (delete, enable, disable, etc.)
  • File upload handled by multer