2024-02-22 07:09:31 +00:00
|
|
|
package config
|
|
|
|
|
2024-02-28 14:04:47 +00:00
|
|
|
import "errors"
|
|
|
|
|
|
|
|
var _ Validator = (*DatabaseConfig)(nil)
|
|
|
|
|
2024-02-22 07:09:31 +00:00
|
|
|
type S3Config struct {
|
|
|
|
BufferBucket string `mapstructure:"buffer_bucket"`
|
|
|
|
Endpoint string `mapstructure:"endpoint"`
|
|
|
|
Region string `mapstructure:"region"`
|
|
|
|
AccessKey string `mapstructure:"access_key"`
|
|
|
|
SecretKey string `mapstructure:"secret_key"`
|
|
|
|
}
|
2024-02-28 14:04:47 +00:00
|
|
|
|
|
|
|
func (s S3Config) Validate() error {
|
|
|
|
if s.BufferBucket == "" {
|
|
|
|
return errors.New("core.storage.s3.buffer_bucket is required")
|
|
|
|
}
|
|
|
|
if s.Endpoint == "" {
|
|
|
|
return errors.New("core.storage.s3.endpoint is required")
|
|
|
|
}
|
|
|
|
if s.Region == "" {
|
|
|
|
return errors.New("core.storage.s3.region is required")
|
|
|
|
}
|
|
|
|
if s.AccessKey == "" {
|
|
|
|
return errors.New("core.storage.s3.access_key is required")
|
|
|
|
}
|
|
|
|
if s.SecretKey == "" {
|
|
|
|
return errors.New("core.storage.s3.secret_key is required")
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|