Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions core/config/application_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ type ApplicationConfig struct {
DisableRuntimeSettings bool

AgentJobRetentionDays int // Default: 30 days

PathWithoutAuth []string
}

type AppOption func(*ApplicationConfig)
Expand All @@ -82,6 +84,15 @@ func NewApplicationConfig(o ...AppOption) *ApplicationConfig {
UploadLimitMB: 15,
Debug: true,
AgentJobRetentionDays: 30, // Default: 30 days
PathWithoutAuth: []string{
"/static/",
"/generated-audio/",
"/generated-images/",
"/generated-videos/",
"/favicon.svg",
"/readyz",
"/healthz",
},
}
for _, oo := range o {
oo(opt)
Expand Down
19 changes: 4 additions & 15 deletions core/http/middleware/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,10 @@ func getApiKeyRequiredFilterFunction(applicationConfig *config.ApplicationConfig
return func(c echo.Context) bool {
path := c.Request().URL.Path

// Always skip authentication for static files
if strings.HasPrefix(path, "/static/") {
return true
}

// Always skip authentication for generated content
if strings.HasPrefix(path, "/generated-audio/") ||
strings.HasPrefix(path, "/generated-images/") ||
strings.HasPrefix(path, "/generated-videos/") {
return true
}

// Skip authentication for favicon
if path == "/favicon.svg" {
return true
for _, p := range applicationConfig.PathWithoutAuth {
if strings.HasPrefix(path, p) {
return true
}
}

// Handle GET request exemptions if enabled
Expand Down
Loading