mongodb-js / version-manager

Cross-platform helper for managing multiple versions of MongoDB

Home Page:https://github.com/mongodb-js/version-manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Move over more parameter normalization

imlucas opened this issue · comments

https://github.com/imlucas/version.mongodb.parts/blob/bb78c8ccd7533b7bb5b55d51431aae0ea2797fbd/lib/index.js#L19-L36

Some systems do weird things that would require extra logic in download scripts (eg '64bit' and 'Windows' in python). Make it easier for everyone so it just lives here.

req.locals = {
    opts: {
      branch: req.param('branch', 'master'),
      platform: req.param('platform', 'linux').toLowerCase(),
      bits: req.param('bits', '64').replace(/[^0-9]/g, ''),
      version: req.param('version'),
      debug: req.param('debug'),
      distro: req.param('distro')
    }
  };

  if(req.locals.opts.platform === 'darwin'){
    req.locals.opts.platform = 'osx';
  }
  if(req.locals.opts.platform === 'windows'){
    req.locals.opts.platform = 'win32';
  }