Meteor-Community-Packages / Meteor-CollectionFS

Reactive file manager for Meteor
MIT License
1.05k stars 237 forks source link

Check for ImageMagick MAGICK_TMPDIR #564

Open szimmer1 opened 9 years ago

szimmer1 commented 9 years ago

Hey guys, I recently had a problem with gm in production ( Modulus.io ) that I didn't have MAGICK_TMPDIR env var set to the server temp directory. I am using ImageMagick.

Could we get error checking, just to report that if !process.env.MAGICK_TMPDIR a console.log happens or Error event is emitted?

Thanks for all your work, Shahar

raix commented 9 years ago

Hi @szimmer1 so you are suggesting is about improving the error message in https://github.com/CollectionFS/Meteor-cfs-graphicsmagick/blob/master/gm.js#L58-L82 ?

adding something like:

  if (!process.env.MAGICK_TMPDIR) {
    // Make a warning about this
    // ref. https://github.com/CollectionFS/Meteor-CollectionFS/issues/564
    console.warn('I can`t read the environment variable "MAGICK_TMPDIR"?\n'+
            'If you are trying to use Graphicsmagick on eg. Modulus.io remember '+
            'to set the "MAGICK_TMPDIR" env var set to the server temp directory :)');
  }

(at https://github.com/CollectionFS/Meteor-cfs-graphicsmagick/blob/master/gm.js#L80 ?)

szimmer1 commented 9 years ago

Yeah. Since it's a operational error I think the best approach is to log an error but not to crash, as you've done. +1 for error reporting :)

Thx