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 5abdc84
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 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,20 @@ func (s *s3Storage) lastModified(ctx context.Context, obj string) (time.Time, er

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

func printDragonsWarning() {
d := `H4sIAJ9WZGcCA6WWwW6DMAyG7zyF1QsxapLbDptU5SkqTYqaKJdJu+wwaSeUZ5/tBNoCG90CaqEI
Pv7/tw3toGkxGfF06loZbQgWwTIaIMXH3aEQQtdEwyvS6Iacir2rvArDf+EEJtoEyKxHUPizx5lT
9ndYCtC54R5nLQoIcQbtcNA45dziIGGKojmhXZJS4IxDswZNmH0Kq2ZPhgThytQEm7Pa5pAQ+jjn
zMLWWLVUTO2qTQidxTJYjAhRPiivfSIIspbCqIZ+oHAgzimOFySVYKOOAHlMME5+fkcADswgGUNB
Oixf1qdxK5Fuqyh0OW1EQ7CUpkQK4FMFzHU5BbOeU45AcZ9RoAR8stY+oSbARRB3CmSuctamWzSq
e3/75Ou5KoMLcP6i5WxJhVDsTftLUqWLYkrd0g+pcVwa3jGgYYQPGHvwdBNmiaubx4/p606Kx3U4
jvp1kHylyv5yudjSQMzKGKZTfY1tgsGaxoUhh6yrDkHUvdyl4uiAh7qOdxdSW0Wz2co0CcNioBio
Zl0j8Mr6it2rQPPYI81WoqoQz0YDjWtBvh5niS/do7xKVJVIMKlpPAg4Hv8CtPUTCxLnJ6j8zOUk
Rj4G5AEItZTxcDgIvl+f98K8PSC7CcXdjdw1Lpg+p8Sb33jiJ6/S7LdYRuv8x1fWbdvwG5l0Myc3
/Fvg4Ur09mphPFMwx74BkGnpvgGxmtNbewkAAA==`
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 5abdc84

Please sign in to comment.