Skip to content

Commit ffd75ec

Browse files
committed
hardcode tigris endpoint
1 parent 3445521 commit ffd75ec

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

main.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,18 @@ import (
2020
)
2121

2222
type Config struct {
23-
S3Endpoint string
2423
S3Bucket string
2524
S3Folder string
2625
TigrisProxyBind string
2726
}
2827

2928
func main() {
3029
cfg := Config{
31-
S3Endpoint: os.Getenv("S3_ENDPOINT"),
3230
S3Bucket: os.Getenv("S3_BUCKET"),
3331
S3Folder: os.Getenv("S3_FOLDER"),
3432
TigrisProxyBind: os.Getenv("IMGPROXY_BIND"),
3533
}
36-
if cfg.S3Endpoint == "" || cfg.S3Bucket == "" {
34+
if cfg.S3Bucket == "" {
3735
slog.Error("Missing required environment variable(s)", "config", cfg)
3836
os.Exit(1)
3937
}
@@ -49,7 +47,7 @@ func main() {
4947
}
5048
proxy := httputil.NewSingleHostReverseProxy(target)
5149

52-
uploader := manager.NewUploader(initS3Client(cfg), func(u *manager.Uploader) {
50+
uploader := manager.NewUploader(initS3Client(), func(u *manager.Uploader) {
5351
u.PartSize = 5 * 1024 * 1024
5452
u.BufferProvider = manager.NewBufferedReadSeekerWriteToPool(10 * 1024 * 1024)
5553
})
@@ -103,15 +101,15 @@ func generateS3Key(path string) string {
103101
return hex.EncodeToString(hash[:])
104102
}
105103

106-
func initS3Client(cfg Config) *s3.Client {
104+
func initS3Client() *s3.Client {
107105
sdkConfig, err := config.LoadDefaultConfig(context.Background())
108106
if err != nil {
109107
slog.Error("Failed to initialize AWS config", "error", err)
110108
os.Exit(1)
111109
}
112110

113111
svc := s3.NewFromConfig(sdkConfig, func(o *s3.Options) {
114-
o.BaseEndpoint = aws.String(cfg.S3Endpoint)
112+
o.BaseEndpoint = aws.String("https://fly.storage.tigris.dev")
115113
o.Region = "auto"
116114
o.UsePathStyle = true
117115
})

0 commit comments

Comments
 (0)