From c74299b59ab5eb9f75f89ac8b91fe33fd89fd24a Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Mon, 7 Apr 2025 16:24:04 +0200 Subject: [PATCH] chore(stdiscosrv): path style s3 --- cmd/stdiscosrv/database.go | 6 +++--- lib/s3/s3.go | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cmd/stdiscosrv/database.go b/cmd/stdiscosrv/database.go index a206d281b..51aa0f64c 100644 --- a/cmd/stdiscosrv/database.go +++ b/cmd/stdiscosrv/database.go @@ -74,16 +74,16 @@ func newInMemoryStore(dir string, flushInterval time.Duration, s3sess *s3.Sessio // Try to read from AWS latestKey, cerr := s3sess.LatestKey() if cerr != nil { - log.Println("Error reading database from S3:", err) + log.Println("Error finding database from S3:", cerr) return s } fd, cerr := os.Create(path.Join(s.dir, "records.db")) if cerr != nil { - log.Println("Error creating database file:", err) + log.Println("Error creating database file:", cerr) return s } if cerr := s3sess.Download(fd, latestKey); cerr != nil { - log.Printf("Error reading database from S3: %v", err) + log.Printf("Error downloading database from S3: %v", cerr) } _ = fd.Close() nr, err = s.read() diff --git a/lib/s3/s3.go b/lib/s3/s3.go index ea76ff07d..e74dfbd0e 100644 --- a/lib/s3/s3.go +++ b/lib/s3/s3.go @@ -26,9 +26,10 @@ type Object = s3.Object func NewSession(endpoint, region, bucket, accessKeyID, secretKey string) (*Session, error) { sess, err := session.NewSession(&aws.Config{ - Region: aws.String(region), - Endpoint: aws.String(endpoint), - Credentials: credentials.NewStaticCredentials(accessKeyID, secretKey, ""), + Region: aws.String(region), + Endpoint: aws.String(endpoint), + Credentials: credentials.NewStaticCredentials(accessKeyID, secretKey, ""), + S3ForcePathStyle: aws.Bool(true), }) if err != nil { return nil, err