Skip to content

Commit dd9c2da

Browse files
committed
feat(workflow): add parameters to determine that s3 enabled SSE
1 parent 89cb370 commit dd9c2da

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

rootfs/docker-entrypoint-initdb.d/001_setup_envdir.sh

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ if [[ "$DATABASE_STORAGE" == "s3" || "$DATABASE_STORAGE" == "minio" ]]; then
66
AWS_ACCESS_KEY_ID=$(cat /var/run/secrets/deis/objectstore/creds/accesskey)
77
AWS_SECRET_ACCESS_KEY=$(cat /var/run/secrets/deis/objectstore/creds/secretkey)
88
if [[ "$DATABASE_STORAGE" == "s3" ]]; then
9+
S3_SSE=$(cat /var/run/secrets/deis/objectstore/creds/sse)
910
AWS_REGION=$(cat /var/run/secrets/deis/objectstore/creds/region)
1011
BUCKET_NAME=$(cat /var/run/secrets/deis/objectstore/creds/database-bucket)
1112
# Convert $AWS_REGION into $WALE_S3_ENDPOINT to avoid "Connection reset by peer" from
@@ -17,6 +18,7 @@ if [[ "$DATABASE_STORAGE" == "s3" || "$DATABASE_STORAGE" == "minio" ]]; then
1718
else
1819
echo "https+path://s3-${AWS_REGION}.amazonaws.com:443" > WALE_S3_ENDPOINT
1920
fi
21+
echo $S3_SSE > WALE_S3_SSE
2022
else
2123
AWS_REGION="us-east-1"
2224
BUCKET_NAME="dbwal"

rootfs/patcher-script.d/patch_wal_e_s3.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ def wrap_uri_put_file(creds, uri, fp, content_type=None, conn=None):
77
k = s3_util._uri_to_key(creds, uri, conn=conn)
88
if content_type is not None:
99
k.content_type = content_type
10+
11+
# Currently WALE only supports AES256, so it's a boolean value.
12+
encrypt_key = False
1013
if os.getenv('DATABASE_STORAGE') == 's3':
11-
encrypt_key=True
12-
else:
13-
encrypt_key=False
14+
if os.getenv('WALE_S3_SSE', 'None') == 'AES256':
15+
encrypt_key = True
1416
k.set_contents_from_file(fp, encrypt_key=encrypt_key)
1517
return k
1618
s3.uri_put_file = wrap_uri_put_file

0 commit comments

Comments
 (0)