From c265a96e0ce13455bf7946f48a5455a553a5d6c7 Mon Sep 17 00:00:00 2001 From: Al Cutter Date: Thu, 19 Dec 2024 17:24:34 +0000 Subject: [PATCH] Add warning about running on non-AWS infra --- storage/aws/aws.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/storage/aws/aws.go b/storage/aws/aws.go index def57805..be06fbb1 100644 --- a/storage/aws/aws.go +++ b/storage/aws/aws.go @@ -30,8 +30,10 @@ package aws import ( "bytes" + "compress/gzip" "context" "database/sql" + "encoding/base64" "encoding/gob" "errors" "fmt" @@ -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) @@ -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) +}