chore(stdiscosrv): path style s3

This commit is contained in:
Jakob Borg
2025-04-07 16:24:04 +02:00
parent 8b6d837483
commit c74299b59a
2 changed files with 7 additions and 6 deletions

View File

@@ -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()

View File

@@ -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