feat(frpc): improve boot service error handling and response

- Add bootServiceError field to system config modify response when boot service operations fail
- Include instanceID in list instances response
- Update error message for unknown modify type
- Document bootServiceError behavior in README
This commit is contained in:
2026-03-03 22:31:39 +08:00
parent 1dc0d840b0
commit f5e6120807
4 changed files with 58 additions and 3 deletions
+27
View File
@@ -355,6 +355,33 @@ Modify system-level settings such as instance name, boot-at-start configuration,
}
```
**Response with bootServiceError (when boot service operations fail):**
```json
{
"success": true,
"message": "System config modified successfully",
"data": {
"instanceName": "new_frpc_name",
"instanceID": 1,
"configPath": "./configs/superfrpc_user_new_frpc_name.toml",
"bootAtStart": true,
"runUser": "www-data",
"bootServiceError": "Failed to create boot service: unsupported init system"
}
}
```
> **Note about bootServiceError:**
> - The `bootServiceError` field appears in the response when boot service operations (create/remove) fail
> - This field is only present when there is an error; it will not be included in the response if operations succeed
> - The overall request still returns `success: true` because the system config modification (database update, config file rename, etc.) succeeded
> - Common scenarios where `bootServiceError` may appear:
> - Enabling `bootAtStart` when the init system is not supported (e.g., on Windows or systems without systemd/init.d)
> - Disabling `bootAtStart` when the service file cannot be removed due to permission issues
> - Changing instance name or run user when `bootAtStart` is enabled (requires removing old service and creating new one)
> - The error message provides detailed information about what went wrong, which should be displayed to the user
> - Frontend applications should check for this field and display the error message to the user, even though the request was technically successful
---
### 6. List frpc Instances