Skip to content

Commit

Permalink
Add warning about running on non-AWS infra
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCutter committed Dec 19, 2024
1 parent 07b7d0d commit c265a96
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions storage/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ package aws

import (
"bytes"
"compress/gzip"
"context"
"database/sql"
"encoding/base64"
"encoding/gob"
"errors"
"fmt"
Expand Down Expand Up @@ -150,6 +152,8 @@ func New(ctx context.Context, cfg Config, opts ...func(*options.StorageOptions))
return nil, fmt.Errorf("failed to load default AWS configuration: %v", err)
}
cfg.SDKConfig = &sdkConfig
} else {
printDragonsWarning()
}
c := s3.NewFromConfig(*cfg.SDKConfig, cfg.S3Options)

Expand Down Expand Up @@ -887,3 +891,13 @@ func (s *s3Storage) lastModified(ctx context.Context, obj string) (time.Time, er

return *r.LastModified, r.Body.Close()
}

func printDragonsWarning() {
d := `H4sIAFZYZGcAA01QMQ7EIAzbeYXV5UCqkq1bf2IFtpNuPalj334hFQdkwLGNAwBzyXnKitOiqTYj
B7ZGplWEwZhZqxZ1aKuswcD0AA4GXPUhI0MEpSd5Ow09vJ+m6rVtF6m0GDccYXDZEdp9N/g1H9Pf
Qu80vNj7tiOe0lkdc8hwZK9YxavT0+FTP++vU6DUKvpEOr1+VGTk3IBXKSX9AHz5xXRgAQAA`
g, _ := base64.StdEncoding.DecodeString(d)
r, _ := gzip.NewReader(bytes.NewReader(g))
t, _ := io.ReadAll(r)
klog.Infof("Running in non-AWS mode: here be dragons!\n%s", t)
}

0 comments on commit c265a96

Please sign in to comment.