Adjusted launch procedure to use conditional app configuration based on NODE_ENV. Also included a warning on launch that Ghost is development software.

This commit is contained in:
Christopher Giffard 2013-07-25 22:22:45 +10:00
parent 273e2172cb
commit 799911c4a3
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",