Validate checks the configuration to enable global configuration check.
()
| 87 | |
| 88 | // Validate checks the configuration to enable global configuration check. |
| 89 | func (config *AuditLogConfig) Validate() error { |
| 90 | if !config.Enable { |
| 91 | return nil |
| 92 | } |
| 93 | if err := config.Format.Validate(); err != nil { |
| 94 | return wrap(err, "format") |
| 95 | } |
| 96 | if err := config.Storage.Validate(); err != nil { |
| 97 | return wrap(err, "storage") |
| 98 | } |
| 99 | switch config.Storage { |
| 100 | case AuditLogStorageFile: |
| 101 | return wrap(config.File.Validate(), "file") |
| 102 | case AuditLogStorageS3: |
| 103 | return wrap(config.S3.Validate(), "s3") |
| 104 | } |
| 105 | return nil |
| 106 | } |
| 107 | |
| 108 | // AuditLogFileConfig is the configuration for the file storage. |
| 109 | type AuditLogFileConfig struct { |