refactor: rename 'entry' to 'ip' in audit log schema
Rename the 'entry' column to 'ip' throughout the database schema and function signatures for clarity. This affects both the CREATE TABLE statement and all INSERT queries in the audit_log table. The parameter naming in AddPermanentEntry, DeletePermanentEntry, and AddTempEntry functions has also been updated to reflect the more specific 'ip' terminology. Corresponding log messages have been adjusted to use 'temp ip' instead of 'temp entry' for consistency.
This commit is contained in:
@@ -89,7 +89,7 @@ func whitelistTempHandler(cfg Config, db *sql.DB) http.HandlerFunc {
|
||||
}
|
||||
clientIP := getClientIP(r)
|
||||
if err := AddTempEntry(db, req.IP, req.TTLSeconds, req.Reason, clientIP); err != nil {
|
||||
slog.Error("failed to add temp entry", "error", err)
|
||||
slog.Error("failed to add temp ip", "error", err)
|
||||
http.Error(w, "internal error", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
@@ -153,7 +153,7 @@ func whitelistDeleteHandler(cfg Config, db *sql.DB) http.HandlerFunc {
|
||||
}
|
||||
clientIP := getClientIP(r)
|
||||
if err := DeleteTempEntry(db, ip, clientIP); err != nil {
|
||||
slog.Error("failed to delete temp entry", "error", err)
|
||||
slog.Error("failed to delete temp ip", "error", err)
|
||||
http.Error(w, "internal error", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
@@ -169,7 +169,7 @@ func logsHandler(cfg Config, db *sql.DB) http.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
query := `SELECT timestamp, action, entry, ttl_seconds, reason, api_client_ip FROM audit_log`
|
||||
query := `SELECT timestamp, action, ip, ttl_seconds, reason, api_client_ip FROM audit_log`
|
||||
var args []any
|
||||
|
||||
filterAction := r.URL.Query().Get("action")
|
||||
|
||||
Reference in New Issue
Block a user