Skip to content

Commit

Permalink
Merge pull request #19 from pelias/more-friendly-warnings
Browse files Browse the repository at this point in the history
feat(download): Use friendly warnings when Transit config is empty
  • Loading branch information
orangejulius authored Oct 7, 2018
2 parents ba62f6a + 6d2184e commit 45c5542
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions lib/prep_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ const path = require('path');
const request = require('sync-request');
const utils = require('./utils');
const stops = require('./stops');
const logger = require( 'pelias-logger' ).get('transit');

const BUF_LENGTH = 64*1024;

// step 1: get transit configuration from pelias.json ... note potential early process exit
const transitConfig = utils.getTransitConfig();
const bkupDir = path.join(transitConfig.datapath, 'backup');

if (!transitConfig.feeds) {
logger.warn('transit config has no `feed` entries, Transit importer quitting after taking no action');
process.exit(0);
}

// step 2: make sure (as best as we can) we have a directory to write things into
mkdir(transitConfig.datapath);
mkdir(bkupDir);
Expand Down
4 changes: 2 additions & 2 deletions schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ const arrayObj = Joi.object().keys({
*/
module.exports = Joi.object().keys({
datapath: Joi.string(),
feeds: Joi.array().min(1).items(arrayObj),
}).requiredKeys('datapath', 'feeds');
feeds: Joi.array().items(arrayObj)
}).requiredKeys('datapath');

0 comments on commit 45c5542

Please sign in to comment.