Skip to content

Commit 13c01c3

Browse files
authored
Merge pull request #12 from mgerni/new-fix2
New fix2
2 parents f4d8602 + aa91183 commit 13c01c3

9 files changed

Lines changed: 22216 additions & 7127 deletions

File tree

config.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
import base64
44

55
def create_pem_from_base64(base64_string, filename):
6+
# if certificate already exists, return
7+
if os.path.exists(filename):
8+
return
9+
610
decoded_data = base64.b64decode(base64_string)
711

812
# save to file
@@ -23,4 +27,9 @@ def create_pem_from_base64(base64_string, filename):
2327
tls=True,
2428
tlsCertificateKeyFile="certificate.pem")
2529
else:
26-
MONGO_CLIENT = pymongo.MongoClient(MONGO_URL)
30+
if os.path.exists("certificate.pem"):
31+
MONGO_CLIENT = pymongo.MongoClient(MONGO_URL,
32+
tls=True,
33+
tlsCertificateKeyFile="certificate.pem")
34+
else:
35+
MONGO_CLIENT = pymongo.MongoClient(MONGO_URL)

0 commit comments

Comments
 (0)