Skip to content

Commit

Permalink
Merge pull request #662 from NBISweden/test-prod
Browse files Browse the repository at this point in the history
Merge latest from test-prod to production
  • Loading branch information
jhagberg authored May 23, 2023
2 parents 4018fa6 + 5f18286 commit 3c3ad59
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
7 changes: 4 additions & 3 deletions app/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
APScheduler==3.10.0
boto3==1.26.79
botocore==1.29.79
botocore==1.29.138
cryptography==39.0.1
endesive==2.0.9
Flask_Caching==2.0.2
flask_dance==6.2.0
Flask_Login==0.6.2
Flask-Session2
Flask==2.3.2
Flask==2.2.5
google-auth
moto==4.1.3
pdfrw2==0.5.0
Expand All @@ -18,4 +18,5 @@ pyOpenSSL==23.0.0
qrcode==7.4.2
requests
setuptools==65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
Werkzeug==2.3.3
Werkzeug==2.3.4

7 changes: 4 additions & 3 deletions app/utils/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def __init__(
secret_key,
access_key,
verify,
use_ssl,
cert,
private_key,
): # pylint: disable=too-many-arguments
Expand All @@ -40,6 +41,8 @@ def __init__(
self.secret_key = secret_key
assert isinstance(verify, (bool, Path))
self.verify = verify
assert isinstance(use_ssl, (bool, Path))
self.use_ssl = use_ssl
assert isinstance(cert, (Path, type(None)))
self.cert = cert
assert isinstance(private_key, (Path, type(None)))
Expand All @@ -49,11 +52,8 @@ def __init__(
"connect_timeout": 40,
}

use_ssl = False

if cert and private_key:
config_params["client_cert"] = (cert, private_key)
use_ssl = True

config = botocore.client.Config(**config_params)
self.s3_client = boto3.client(
Expand Down Expand Up @@ -148,6 +148,7 @@ def get_s3_client():
secret_key=settings.s3.secret_key,
access_key=settings.s3.access_key,
verify=settings.s3.verify,
use_ssl=settings.s3.use_ssl,
cert=settings.s3.cert,
private_key=settings.s3.private_key,
)
Expand Down
1 change: 1 addition & 0 deletions app/utils/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@
s3.secret_key = os.environ.get("S3_SECRETKEY", "secretkeytest")
s3.access_key = os.environ.get("S3_ACCESSKEY", "accesskeytest")
s3.verify = json.loads(os.environ.get("S3_VERIFY", "True").lower())
s3.use_ssl = json.loads(os.environ.get("S3_USESSL", "True").lower())
s3.cert = None
s3.private_key = None

0 comments on commit 3c3ad59

Please sign in to comment.