vsivsi / meteor-file-collection

Extends Meteor Collections to handle file data using MongoDB gridFS.
http://atmospherejs.com/vsivsi/file-collection
Other
159 stars 37 forks source link

Mongo connections with SSL turned on fail with SELF SIGNED CERT error #126

Closed oceddi closed 8 years ago

oceddi commented 8 years ago

When using a MONGO_URL that is connecting to mongodb using ssl=true, an error will occur about using a SELF SIGNED CERTIFICATE. This is because the mongo connection in gridFS_server.coffee isn't passing in an sslCA option in the options object (currently your code hard codes it to an empty object).

It would be nice if you supported an option in your FileCollection to specify these mongodb connection options (i.e. somthing like a mongoOptions attribute).

Line 35 in gridFS_server.coffee would change to something like:

@db = Meteor.wrapAsync(mongodb.MongoClient.connect)(process.env.MONGO_URL, options.mongoOptions ? {})

I tested this on a local branch and it resolved my problem with using your module in meteor with ssl=true in the MONGO_URL.

vsivsi commented 8 years ago

Good catch. The long-term solution here is for Meteor to update to use the modern MongoDB node.js driver. All of the internal stuff that file-collection does (managing its own connection to Mongo) is because the Meteor driver connection is too out-of-date to properly support gridFS. I have raised this issue with MDG and they haven't acted on it for nearly over a year. 😦

See here for more context: https://github.com/vsivsi/meteor-file-collection/issues/95#issuecomment-201418223

Any chance you can put together a PR that resolves this issue?

oceddi commented 8 years ago

PR: https://github.com/vsivsi/meteor-file-collection/pull/127

vsivsi commented 8 years ago

Great! Closing this one to concentrate on the PR