refactor(internal): replace log.Fatal with panic, add timezone to DSN, add empty S3 bucket check
Replace log.Fatal in dev service init with panic for consistency. Add timezone=UTC to DAV connection DSN. Add IsEmpty() check for S3 dev bucket. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -23,6 +23,7 @@ type Uploader interface {
|
||||
Download(ctx context.Context, bucket, key string, w io.Writer) error
|
||||
Delete(ctx context.Context, bucket, key string) error
|
||||
GetURL(ctx context.Context, bucket, key string) (string, error)
|
||||
HealthCheck(ctx context.Context) error
|
||||
}
|
||||
|
||||
type S3Client struct {
|
||||
@@ -202,3 +203,13 @@ func (s *S3Client) Delete(ctx context.Context, bucket, key string) error {
|
||||
func (s *S3Client) GetURL(ctx context.Context, bucket, key string) (string, error) {
|
||||
return fmt.Sprintf("%s/%s/%s", s.publicURL, bucket, key), nil
|
||||
}
|
||||
|
||||
func (s *S3Client) HealthCheck(ctx context.Context) error {
|
||||
_, err := s.client.HeadBucket(ctx, &s3.HeadBucketInput{
|
||||
Bucket: aws.String(s.bucket),
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("S3 bucket %q is not accessible (check S3_PUBLIC_URL / RUSTFS_ENDPOINT config): %w", s.bucket, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user