You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
returnnil, fmt.Errorf("S3_ACCESS_KEY_ID or AWS_ACCESS_KEY_ID is set but S3_SECRET_ACCESS_KEY or AWS_SECRET_ACCESS_KEY is missing")
48
+
49
+
// If neither access key nor secret is set, return nil (not configured, will use IRSA/default credentials)
50
+
ifaccessKeyID==""&&secretAccessKey=="" {
51
+
returnnil, nil// Not an error, just not configured - will use default AWS credentials chain (IRSA)
52
+
}
53
+
54
+
// If only secret is set without access key, that's an error
55
+
ifaccessKeyID==""&&secretAccessKey!="" {
56
+
returnnil, fmt.Errorf("S3_SECRET_ACCESS_KEY or AWS_SECRET_ACCESS_KEY is set but S3_ACCESS_KEY_ID or AWS_ACCESS_KEY_ID is missing")
57
+
}
58
+
59
+
// If only access key is set without secret, that's also an error (inconsistent state)
60
+
// For IRSA, both should be unset to use IAM role credentials
61
+
ifaccessKeyID!=""&&secretAccessKey=="" {
62
+
returnnil, fmt.Errorf("S3_ACCESS_KEY_ID or AWS_ACCESS_KEY_ID is set but S3_SECRET_ACCESS_KEY or AWS_SECRET_ACCESS_KEY is missing (for IRSA, leave both unset)")
// If nil, that's OK - will use default AWS credentials chain (IRSA)
184
202
s3Config, err:=LoadS3ConfigFromEnv()
185
203
iferr!=nil {
186
204
returnnil, fmt.Errorf("failed to load S3 configuration: %w", err)
187
205
}
206
+
// If s3Config is nil, create a minimal config with just region for IRSA
188
207
ifs3Config==nil {
189
-
returnnil, fmt.Errorf("S3 storage URI specified but S3 configuration not found in environment variables (S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY required)")
208
+
region:=os.Getenv("S3_REGION")
209
+
ifregion=="" {
210
+
region=os.Getenv("AWS_REGION")
211
+
}
212
+
ifregion=="" {
213
+
region="us-east-1"// Default region
214
+
}
215
+
s3Config=&S3Config{
216
+
AccessKeyID: "", // Empty for IRSA
217
+
SecretAccessKey: "", // Empty for IRSA
218
+
Endpoint: "", // AWS S3
219
+
Region: region,
220
+
UseSSL: true, // AWS S3 default
221
+
URLStyle: "virtual", // AWS S3 default
222
+
}
190
223
}
191
224
192
225
// If using localhost MinIO, ensure the bucket exists
0 commit comments