From 61fa9709f2097e39a7b5585b6023750abefd59c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Efe=20=C3=87etin?= Date: Fri, 4 Feb 2022 23:53:36 +0300 Subject: [PATCH] :fire: several updates for s3 (#322) * updates for s3. * fix linter --- .github/dependabot.yml | 9 +++++++++ s3/s3.go | 11 ++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 3584adc7..e6603bd3 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -110,3 +110,12 @@ updates: automerged_updates: - match: dependency_name: "gofiber/fiber/*" + - package-ecosystem: "gomod" + directory: "/s3/" # Location of package manifests + default_labels: + - "🤖 Dependencies" + schedule: + interval: "daily" + automerged_updates: + - match: + dependency_name: "gofiber/fiber/*" diff --git a/s3/s3.go b/s3/s3.go index 12c22151..da328a51 100644 --- a/s3/s3.go +++ b/s3/s3.go @@ -41,13 +41,22 @@ func New(config ...Config) *Storage { } sess := s3.NewFromConfig(awscfg) - return &Storage{ + storage := &Storage{ svc: sess, downloader: manager.NewDownloader(sess), uploader: manager.NewUploader(sess), requestTimeout: cfg.RequestTimeout, bucket: cfg.Bucket, } + + // Reset all entries if set to true + if cfg.Reset { + if err := storage.Reset(); err != nil { + panic(err) + } + } + + return storage } // Get value by key