MCPcopy
hub / github.com/ContainerSSH/ContainerSSH / Validate

Method Validate

config/auditlog.go:141–168  ·  view source on GitHub ↗

Validate validates the

()

Source from the content-addressed store, hash-verified

139
140// Validate validates the
141func (config AuditLogS3Config) Validate() error {
142 if config.Local == "" {
143 return newError("local", "empty local storage directory provided")
144 }
145 stat, err := os.Stat(config.Local)
146 if err != nil {
147 return wrapWithMessage(err, "local", "invalid local directory: %s", config.Local)
148 }
149 if !stat.IsDir() {
150 return newError("local", "invalid local directory: %s (not a directory)", config.Local)
151 }
152 if config.AccessKey == "" {
153 return newError("accessKey", "no access key provided")
154 }
155 if config.SecretKey == "" {
156 return newError("secretKey", "no secret key provided")
157 }
158 if config.Bucket == "" {
159 return newError("bucket", "no bucket name provided")
160 }
161 if config.UploadPartSize < 5242880 {
162 return newError("uploadPartSize", "upload part size too low %d (minimum 5 MB)", config.UploadPartSize)
163 }
164 if config.ParallelUploads < 1 {
165 return newError("parallelUploads", "parallel uploads invalid: %d (must be positive)", config.ParallelUploads)
166 }
167 return nil
168}
169
170// AuditLogS3Metadata AuditLogS3Metadata configuration for the S3 storage
171type AuditLogS3Metadata struct {

Callers

nothing calls this directly

Calls 2

newErrorFunction · 0.85
wrapWithMessageFunction · 0.85

Tested by

no test coverage detected