Improve environment variable stuff

This commit is contained in:
Jonathan Cremin 2015-08-30 18:35:05 +02:00
parent 760ee07a2e
commit 6ba174cff0
16 changed files with 66 additions and 64 deletions

View file

@ -16,7 +16,7 @@ const router = new Router();
router.use(errors({template: path.join(__dirname, 'public', 'error.html')}));
const statsdOpts = {prefix: 'hostr-web', host: process.env.STATSD_HOST || 'localhost'};
const statsdOpts = {prefix: 'hostr-web', host: process.env.STATSD_HOST};
router.use(stats(statsdOpts));
const statsd = new StatsD(statsdOpts);
router.use(function* statsMiddleware(next) {
@ -29,8 +29,8 @@ router.use(redis.sessionStore());
router.use(function* stateMiddleware(next) {
this.state = {
session: this.session,
apiURL: process.env.API_URL,
baseURL: process.env.BASE_URL,
baseURL: process.env.WEB_BASE_URL,
apiURL: process.env.API_BASE_URL,
stripePublic: process.env.STRIPE_PUBLIC_KEY,
};
yield next;

View file

@ -94,11 +94,11 @@ export function* signup(email, password, ip) {
};
Users.insertOne(user);
const html = yield render('email/inlined/activate', {activationUrl: process.env.BASE_URL + '/activate/' + user.activationCode});
const html = yield render('email/inlined/activate', {activationUrl: process.env.WEB_BASE_URL + '/activate/' + user.activationCode});
const text = `Thanks for signing up to Hostr!
Please confirm your email address by clicking the link below.
${process.env.BASE_URL + '/activate/' + user.activationCode}
${process.env.WEB_BASE_URL + '/activate/' + user.activationCode}
Jonathan Cremin, Hostr Founder
`;
@ -130,9 +130,9 @@ export function* sendResetToken(email) {
'token': token,
'created': Math.round(new Date().getTime() / 1000),
});
const html = yield render('email/inlined/forgot', {forgotUrl: process.env.BASE_URL + '/forgot/' + token});
const html = yield render('email/inlined/forgot', {forgotUrl: process.env.WEB_BASE_URL + '/forgot/' + token});
const text = `It seems you've forgotten your password :(
Visit ${process.env.BASE_URL + '/forgot/' + token} to set a new one.
Visit ${process.env.WEB_BASE_URL + '/forgot/' + token} to set a new one.
`;
mandrill.messages.send({message: {
html: html,

View file

@ -3,7 +3,7 @@ import mime from 'mime-types';
import hostrFileStream from '../../lib/hostr-file-stream';
import { formatFile } from '../../lib/format';
const storePath = process.env.STORE_PATH || path.join(process.env.HOME, '.hostr', 'uploads');
const storePath = process.env.UPLOAD_STORAGE_PATH;
function userAgentCheck(userAgent) {
if (!userAgent) {

View file

@ -6,8 +6,8 @@ const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
import { Mandrill } from 'mandrill-api/mandrill';
const mandrill = new Mandrill(process.env.MANDRILL_KEY);
const fromEmail = process.env.EMAIL_FROM || 'nobody@example.com';
const fromName = process.env.EMAIL_NAME || 'Nobody';
const fromEmail = process.env.EMAIL_FROM;
const fromName = process.env.EMAIL_NAME;
export function* create() {
const Users = this.db.Users;