Skip to content

Commit 0cc6b36

Browse files
authored
Fix linting (#4)
* Fix linting Signed-off-by: Dan Webb <dan.webb@damacus.io> * fix: replace deprecated LoggerWithConfig with RequestLoggerWithConfig --------- Signed-off-by: Dan Webb <dan.webb@damacus.io>
1 parent caf6d5e commit 0cc6b36

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

cmd/server/main.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,14 @@ func main() {
3535
dashboardHandler := handlers.NewDashboardHandler(minioFactory)
3636

3737
// Middleware
38-
e.Use(middleware.Logger())
38+
e.Use(middleware.RequestLoggerWithConfig(middleware.RequestLoggerConfig{
39+
LogStatus: true,
40+
LogURI: true,
41+
LogValuesFunc: func(c echo.Context, v middleware.RequestLoggerValues) error {
42+
log.Printf("REQUEST: uri: %v, status: %v\n", v.URI, v.Status)
43+
return nil
44+
},
45+
}))
3946
e.Use(middleware.Recover())
4047
// Apply auth middleware globally - it will skip public routes internally
4148
e.Use(customMiddleware.AuthMiddleware(authService))

internal/services/auth_service_test.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ func TestNewAuthService_GeneratesKey(t *testing.T) {
1111

1212
svc := NewAuthService()
1313

14-
if svc == nil {
15-
t.Fatal("expected non-nil AuthService")
16-
}
1714
if len(svc.encryptionKey) != 32 {
1815
t.Errorf("expected 32-byte key, got %d bytes", len(svc.encryptionKey))
1916
}
@@ -26,9 +23,6 @@ func TestNewAuthService_UsesEnvKey(t *testing.T) {
2623

2724
svc := NewAuthService()
2825

29-
if svc == nil {
30-
t.Fatal("expected non-nil AuthService")
31-
}
3226
if string(svc.encryptionKey) != testKey {
3327
t.Errorf("expected key %q, got %q", testKey, string(svc.encryptionKey))
3428
}
@@ -40,9 +34,6 @@ func TestNewAuthService_IgnoresShortEnvKey(t *testing.T) {
4034

4135
svc := NewAuthService()
4236

43-
if svc == nil {
44-
t.Fatal("expected non-nil AuthService")
45-
}
4637
// Should generate a new key since env key is too short
4738
if len(svc.encryptionKey) != 32 {
4839
t.Errorf("expected 32-byte generated key, got %d bytes", len(svc.encryptionKey))

0 commit comments

Comments
 (0)