sourcegraph/internal/audit/security_events.go
Dax McDonald c0dee2bb0b
disable audit logging to db by default (#51686)
Security event logs are no longer logged to the `security_event_log` table by default after this change. They are now configurable through the site_config


---------

Co-authored-by: Robert Lin <robert@bobheadxi.dev>
2023-05-23 18:10:43 +00:00

37 lines
684 B
Go

package audit
import "github.com/sourcegraph/sourcegraph/schema"
type SecurityEventsLocation int
const (
None = iota
AuditLog
Database
All
)
func SecurityEventLocation(cfg schema.SiteConfiguration) SecurityEventsLocation {
if securityEvent := securityEventConf(cfg); securityEvent != nil {
switch securityEvent.Location {
case "none":
return None
case "auditlog":
return AuditLog
case "database":
return Database
case "all":
return All
}
}
// default to AuditLog
return AuditLog
}
func securityEventConf(cfg schema.SiteConfiguration) *schema.SecurityEventLog {
if logCg := cfg.Log; logCg != nil {
return logCg.SecurityEventLog
}
return nil
}