Set S3 Storage Region in Package Manager and Chronicle#48
Conversation
|
Claude finished @timtalbot's task —— View job Reviewing PR #48
Reviewed this PR. The refactoring is clean and follows existing patterns. Left two minor suggestions:
Overall a solid fix for the Package Manager region requirement. |
There was a problem hiding this comment.
Review Summary
Clean refactoring that addresses an important compatibility issue. The changes follow existing patterns and include proper test coverage.
Feedback
api/product/util.go:95 - The doc comment references "secret operations" but GetAWSRegion() is now used more broadly for storage configs. Consider generalizing:
// GetAWSRegion returns the AWS region to use for AWS services.api/product/util_test.go:100-116 - The environment variable save/restore logic could be simplified using t.Setenv() which automatically cleans up after each test (Go 1.17+):
t.Run(tt.name, func(t *testing.T) {
if tt.awsRegion != "" {
t.Setenv("AWS_REGION", tt.awsRegion)
}
if tt.awsDefault != "" {
t.Setenv("AWS_DEFAULT_REGION", tt.awsDefault)
}
if got := product.GetAWSRegion(); got != tt.want {
t.Errorf("GetAWSRegion() = %v, want %v", got, tt.want)
}
})Checklist
Controller Changes:
- Config flows from Site → Product correctly
- Changes are idempotent (region is read from env each reconcile)
Security:
- No credential handling concerns - region is not sensitive data
- Using standard AWS SDK region constants
The default to us-east-2 for backwards compatibility is reasonable. Overall this is a solid fix.
Summary
New versions of Package Manager now require that the AWS region be set in storage config when using s3 storage. This sets the region and also addresses a previously hard-coded region in the Chronicle s3 storage config.
Changes
Core functionality
GetAWSRegion()utility function (moved fromsecret.go) that:AWS_REGIONenvironment variable firstAWS_DEFAULT_REGIONif not setus-east-2for backwards compatibilityGetAWSRegion()functionpm.Spec.Config.S3Storage.RegionusingGetAWSRegion()us-east-2withGetAWSRegion()for consistencyTesting
GetAWSRegion()including:Housekeeping
bin/directory to ignore build artifacts"Bash(make *)": Use ":*" for prefix matching, not just "*". Change to "Bash(make :*)" for prefix matching. Examples: Bash(npm run:*), Bash(git:*))