Clean up config (non-env based settings)

closes #625
- removed defaultLang, forceI18n and activePlugins from config
- added values to default-settings.json
- updated to use values from settings
This commit is contained in:
Sebastian Gierlinger 2013-09-06 13:34:44 +02:00 committed by Hannah Wolfe
parent 630c03d4d4
commit d9fb23496c
5 changed files with 15 additions and 22 deletions

View File

@ -3,22 +3,6 @@
var path = require('path'),
config = {};
// ## Admin settings
// Default language
config.defaultLang = 'en';
// Force i18n to be on
config.forceI18n = true;
// ## Plugins
// Current active plugins
config.activePlugins = [
'FancyFirstChar'
];
// ## Default Navigation Items
// Add new objects here to extend the menu output by {{nav}}
config.nav = [

View File

@ -146,11 +146,11 @@ Ghost.prototype.init = function () {
instance.mail.init(self)
).then(function () {
return models.Settings.populateDefaults();
}).then(function () {
return self.initPlugins();
}).then(function () {
// Initialize the settings cache
return self.updateSettingsCache();
}).then(function () {
return self.initPlugins();
}).then(function () {
// Initialize the permissions actions and objects
return permissions.init();
@ -301,7 +301,7 @@ Ghost.prototype.doFilter = function (name, args, callback) {
// Initialise plugins. Will load from config.activePlugins by default
Ghost.prototype.initPlugins = function (pluginsToLoad) {
pluginsToLoad = pluginsToLoad || config.activePlugins;
pluginsToLoad = pluginsToLoad || models.Settings.activePlugins;
var self = this;

View File

@ -44,10 +44,19 @@
"value": "",
"type": "blog"
},
{
"key": "defaultLang",
"value": "en",
"type": "blog"
},
{
"key": "forceI18n",
"value": true,
"type": "blog"
},
{
"key": "postsPerPage",
"value": "6",
"type": "blog"
}
]

View File

@ -223,7 +223,7 @@ coreHelpers = function (ghost) {
ghost.registerThemeHelper('e', function (key, defaultString, options) {
var output;
if (ghost.config().defaultLang === 'en' && _.isEmpty(options.hash) && !ghost.config().forceI18n) {
if (ghost.settings().defaultLang === 'en' && _.isEmpty(options.hash) && !ghost.settings().forceI18n) {
output = defaultString;
} else {
output = ghost.polyglot().t(key, options.hash);

View File

@ -8,7 +8,7 @@ var fs = require('fs'),
I18n = function (ghost) {
// TODO: validate
var lang = ghost.config().defaultLang,
var lang = ghost.settings().defaultLang,
path = ghost.paths().lang,
langFilePath = path + lang + '.json';