mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-24 09:13:11 +01:00
maintain (s3): migrate s3 as a plugin
This commit is contained in:
parent
2138bf0cad
commit
8f1097273e
2 changed files with 4 additions and 2 deletions
|
|
@ -10,6 +10,7 @@ import (
|
|||
_ "github.com/mickael-kerjean/filestash/server/plugin/plg_backend_backblaze"
|
||||
_ "github.com/mickael-kerjean/filestash/server/plugin/plg_backend_dav"
|
||||
_ "github.com/mickael-kerjean/filestash/server/plugin/plg_backend_mysql"
|
||||
_ "github.com/mickael-kerjean/filestash/server/plugin/plg_backend_s3"
|
||||
_ "github.com/mickael-kerjean/filestash/server/plugin/plg_backend_ldap"
|
||||
_ "github.com/mickael-kerjean/filestash/server/plugin/plg_backend_dropbox"
|
||||
_ "github.com/mickael-kerjean/filestash/server/plugin/plg_security_scanner"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package backend
|
||||
package plg_backend_s3
|
||||
|
||||
import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
|
|
@ -28,7 +28,6 @@ func init() {
|
|||
S3Cache = NewAppCache(2, 1)
|
||||
}
|
||||
|
||||
|
||||
func (s S3Backend) Init(params map[string]string, app *App) (IBackend, error) {
|
||||
if params["encryption_key"] != "" && len(params["encryption_key"]) != 32 {
|
||||
return nil, NewError(fmt.Sprintf("Encryption key needs to be 32 characters (current: %d)", len(params["encryption_key"])), 400)
|
||||
|
|
@ -235,6 +234,7 @@ func (s S3Backend) Rm(path string) error {
|
|||
return err
|
||||
}
|
||||
for _, obj := range objs.Contents {
|
||||
// TODO: bug
|
||||
_, err := client.DeleteObject(&s3.DeleteObjectInput{
|
||||
Bucket: aws.String(p.bucket),
|
||||
Key: obj.Key,
|
||||
|
|
@ -244,6 +244,7 @@ func (s S3Backend) Rm(path string) error {
|
|||
}
|
||||
}
|
||||
for _, pref := range objs.CommonPrefixes {
|
||||
// TODO: bug
|
||||
s.Rm("/" + p.bucket + "/" + *pref.Prefix)
|
||||
_, err := client.DeleteObject(&s3.DeleteObjectInput{
|
||||
Bucket: aws.String(p.bucket),
|
||||
Loading…
Reference in a new issue