Skip to content

Commit

Permalink
feat(crawler): config
Browse files Browse the repository at this point in the history
  • Loading branch information
njfamirm committed Nov 22, 2022
1 parent f308b46 commit 473d4c7
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions crawler/src/lib/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
import {createLogger} from '@alwatr/logger';

export const logger = createLogger('flight-finder-crawler');

const storageToken = process.env.STORAGE_TOKEN;
const notifierToken = process.env.NOTIFIER_TOKEN;

if (storageToken === undefined) {
logger.accident('config', 'token_required', 'Use NOTIFIER_TOKEN=token STORAGE_TOKEN=token yarn serve');
throw new Error('token_required');
}

export const config = {
storage: {
host: process.env.STORAGE_HOST ?? 'http://127.0.0.1:80',
name: process.env.STORAGE_NAME ?? 'job',
token: storageToken,
},
notifier: {
host: process.env.NOTIFIER_HOST ?? 'http://127.0.0.1:8001',
to: process.env.NOTIFIER_TO ?? 'all',
token: notifierToken!,
},
};

logger.logProperty('config', config);

0 comments on commit 473d4c7

Please sign in to comment.