feat: optional S3-compatible storage for uploaded images, instead of the local upload directory
This commit is contained in:
1 parent
d752a61e52
commit
eb9bfabed5
23 files changed
+1962
-7
No files matched your search
@@ -5,17 +5,23 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
const DriverLocal = "local"
|
||||
const (
|
||||
DriverLocal = "local"
|
||||
DriverS3 = "s3"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Driver string
|
||||
Location string
|
||||
S3 S3Config
|
||||
}
|
||||
|
||||
func Open(config Config) (domain.Storage, error) {
|
||||
switch config.Driver {
|
||||
case DriverLocal:
|
||||
return NewLocalStorage(config.Location), nil
|
||||
case DriverS3:
|
||||
return OpenS3Storage(config.S3)
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported storage driver %q", config.Driver)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user