You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor HTTP response handling and improve error management
- Updated various handlers to use the error return value from `json.NewEncoder(w).Encode(...)` for better error handling.
- Replaced direct calls to `json.NewEncoder(w).Encode(...)` with error checks to ensure proper logging and handling of potential write errors.
- Removed unused error handling functions related to API error responses to streamline the codebase.
- Improved TLS configuration in email service to enforce minimum TLS version.
- Refactored backend server status parsing for clarity and maintainability.
- Removed redundant functions for checking and counting non-hardware backends in the template helper.
- Enhanced rollback handling in plugin migration to ensure proper resource management.
Copy file name to clipboardExpand all lines: gearbox/cmd/server/main.go
+7-5Lines changed: 7 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -78,7 +78,7 @@ func main() {
78
78
iferr!=nil {
79
79
log.Fatalf("Failed to initialize database: %v", err)
80
80
}
81
-
deferdb.Close()
81
+
deferfunc() { _=db.Close() }()
82
82
logger.Info("database initialized",
83
83
"path", cfg.DatabasePath,
84
84
"retention_hours", cfg.DatabaseRetentionHours)
@@ -117,7 +117,7 @@ func main() {
117
117
ifcfg.AdminPassword=="" {
118
118
// SECURITY: Write password to secure file with restrictive permissions
119
119
// File will be auto-deleted after first password change
120
-
credentialsFile:="data/admin-credentials.txt"
120
+
credentialsFile:="data/admin-credentials.txt"//#nosec G101 -- Not a credential; this is a file path constant
121
121
credentialsContent:=fmt.Sprintf("ADMIN USER CREATED\n\nEmail: admin\nPassword: %s\n\nIMPORTANT: You will be forced to change this password on first login.\nThis file will be automatically deleted after you change your password.\n", adminPassword)
0 commit comments