Skip to content

Commit

Permalink
Fix pet peeve
Browse files Browse the repository at this point in the history
  • Loading branch information
armenzg committed Feb 16, 2018
1 parent 54b383d commit 995c24c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/fetch/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { createClient } from 'then-redis';
import fetch from 'node-fetch';
import moment from 'moment';

const os = require('os');

const defaultTtl = moment.duration(8, 'hours').as('seconds');

let db = null;
Expand All @@ -13,8 +11,10 @@ export default async function fetchText(
url,
{ ttl = defaultTtl, headers = {}, method = 'get' } = {},
) {
headers.referer = (process.env.NODE_ENV === 'development') ?
'localhost' : os.hostname();
// XXX: Consider using fqdn
headers.referer = (process.env.NODE_HOME !== '/app/.heroku/node') ?
'localhost' : 'firefox-health-dashboard';
console.log(headers);
const key = `cache:${url}`;
if (typeof ttl === 'string') {
ttl = moment.duration(1, ttl).as('seconds');
Expand Down
6 changes: 5 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ const load = () => {
server.on('listening', () => {
const { address, port } = server.address();
// eslint-disable-next-line
console.log('http://%s:%d/ in %s', address, port, process.env.NODE_ENV || 'dev');
console.log('http://%s:%d/ in %s',
address === '::' ? 'localhost' : address,
port,
process.env.NODE_ENV,
);
});
server.listen(process.env.PORT || 3000);
return server;
Expand Down

0 comments on commit 995c24c

Please sign in to comment.