Reputation: 703
I am building a flask app that will store data in MongoDB. For this I am using Flask-Mongoengine
, now my problem is that I need to use a ssl_ca_cert
and SSL=true
for connecting to MongoDB. I am not able to find any documentation which says anything about this. I know with PyMongo
we can use these options but I want to use it with Flask-Mongoengine. Is there any way I can do that? Any app.config[]
parameter to set the ssl_ca_cert
and ssl=True
? Any help will be appreciated, thanks.
EDIT:
Something is mentioned here about these options but I am not able to figure out how to use them.
Upvotes: 1
Views: 771
Reputation: 6364
I believe you can use the URI string connection for this, i.e the MONGODB_HOST
config parameter (see this for an example).
Something like:
app.config["MONGODB_HOST"] = "mongodb://user:password@hostname:port/db_name?ssl=true&ssl_cert_reqs=CERT_REQUIRED&ssl_ca_certs={your_cert_path}"
Upvotes: 1