From 81d317a1228c6439118cb7b775b0e9173745e66d Mon Sep 17 00:00:00 2001 From: Gabor Javorszky Date: Sat, 15 Jun 2013 00:39:27 +0100 Subject: [PATCH] Replaced config.blogData with settings Solves #112 * Removed config.blogData * Changed Ghost.init() to accommodate new settings bits * (data was already in the fixtures) --- config.js | 11 +---------- core/ghost.js | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/config.js b/config.js index a9f583878a..f18bad386d 100644 --- a/config.js +++ b/config.js @@ -12,15 +12,6 @@ */ var config = {}; - - /** - * Blog settings - */ - config.blogData = { - url: 'http://local.tryghost.org', //'http://john.onolan.org', - title: "Ghost Development", - description: "Interactive designer, public speaker, startup advisor and writer. Living in Austria, attempting world domination via keyboard." - }; // ## Admin settings /** @@ -109,4 +100,4 @@ * @property {Object} exports */ module.exports = config; -}()); \ No newline at end of file +}()); diff --git a/core/ghost.js b/core/ghost.js index 72aa965eed..afc1b80e91 100644 --- a/core/ghost.js +++ b/core/ghost.js @@ -121,9 +121,23 @@ }; Ghost.prototype.init = function () { - this.globalConfig = config.blogData; + var settings = {}, + self = this, + configDeferred = when.defer(), + configPromise = configDeferred.promise; - return when.all([instance.dataProvider.init(), instance.getPaths()]); + models.Settings.findAll().then(function (result) { + _.map(result.models, function (member) { + if (!settings.hasOwnProperty(member.attributes.key)) { + settings[member.attributes.key] = member.attributes.value; + } + }); + configDeferred.resolve(settings); + }); + return when.all([instance.dataProvider.init(), instance.getPaths(), configPromise]).then(function (results) { + self.globalConfig = results[2]; + return; + }); }; /** @@ -230,4 +244,4 @@ // Ghost.defaults = defaults; module.exports = Ghost; -}()); \ No newline at end of file +}());