0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Merge pull request #310 from cgiffard/boot-warning

Include conditional configuration based on NODE_ENV, Adds warning at boot
This commit is contained in:
Hannah Wolfe 2013-07-27 09:25:06 -07:00
commit 93f1baec7f
2 changed files with 23 additions and 8 deletions

View file

@ -4,6 +4,7 @@
var express = require('express'),
when = require('when'),
_ = require('underscore'),
colors = require("colors"),
errors = require('./core/server/errorHandling'),
admin = require('./core/server/controllers/admin'),
frontend = require('./core/server/controllers/frontend'),
@ -116,17 +117,25 @@ disableCachedResult = function (req, res, next) {
next();
};
ghost.app().configure('development', function () {
ghost.app().configure(function() {
ghost.app().use(isGhostAdmin);
ghost.app().use(express.favicon(__dirname + '/content/images/favicon.ico'));
ghost.app().use(express.errorHandler({ dumpExceptions: true, showStack: true }));
ghost.app().use(express.logger('dev'));
ghost.app().use(I18n.load(ghost));
ghost.app().use(express.bodyParser({}));
ghost.app().use(express.cookieParser('try-ghost'));
ghost.app().use(express.cookieSession({ cookie: { maxAge: 60000000 }}));
ghost.app().use(ghost.initTheme(ghost.app()));
ghost.app().use(flash());
if (process.env.NODE_ENV !== "development") {
ghost.app().use(express.logger());
ghost.app().use(express.errorHandler({ dumpExceptions: false, showStack: false }));
}
});
ghost.app().configure("development", function() {
ghost.app().use(express.errorHandler({ dumpExceptions: true, showStack: true }));
ghost.app().use(express.logger('dev'));
});
@ -187,13 +196,18 @@ when.all([ghost.init(), filters.loadCoreFilters(ghost), helpers.loadCoreHelpers(
ghost.app().get('/', frontend.homepage);
ghost.app().get('/page/:page/', frontend.homepage);
ghost.app().listen(
ghost.config().env[process.env.NODE_ENV || 'development'].url.port,
ghost.config().env[process.env.NODE_ENV || 'development'].url.host,
function () {
function() {
// Remove once software becomes suitably 'ready'
console.log(
"\n !!! ALPHA SOFTWARE WARNING !!!\n".red,
"Ghost is in the early stages of development.\n".red,
"Expect to see bugs and other issues (but please report them.)\n".red
);
console.log("Express server listening on address:",
ghost.config().env[process.env.NODE_ENV || 'development'].url.host + ':'
+ ghost.config().env[process.env.NODE_ENV || 'development'].url.port);

View file

@ -20,7 +20,8 @@
"knex": "0.1.7",
"when": "2.1.1",
"bcrypt-nodejs": "0.0.3",
"node-uuid": "1.4.0"
"node-uuid": "1.4.0",
"colors": "~0.6.0-1"
},
"devDependencies": {
"grunt": "~0.4.1",