From 9eff67f92ba5df1b00b60044cb5ce17c6f8cebba Mon Sep 17 00:00:00 2001 From: mashiike Date: Tue, 14 Jun 2022 18:31:18 +0900 Subject: [PATCH] fix config from s3 --- config.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config.go b/config.go index 4139ae5..80423a6 100644 --- a/config.go +++ b/config.go @@ -163,9 +163,10 @@ func fetchConfigFromS3(ctx context.Context, u *url.URL) ([]byte, error) { } downloader := manager.NewDownloader(s3.NewFromConfig(awsCfg)) var buf manager.WriteAtBuffer - downloader.Download(ctx, &buf, &s3.GetObjectInput{ + logx.Printf(ctx, "[debug] try download Bucket=%s, Key=%s", u.Host, u.Path) + _, err = downloader.Download(ctx, &buf, &s3.GetObjectInput{ Bucket: aws.String(u.Host), - Key: aws.String(u.Path), + Key: aws.String(strings.TrimLeft(u.Path, "/")), }) if err != nil { return nil, fmt.Errorf("failed to fetch from S3, %s", err)