Rework config system for easier future expansion with new keys

This commit is contained in:
Mikko Ahlroth 2014-11-16 19:06:03 +02:00
parent 1d925ea17d
commit 860d3b6146
2 changed files with 15 additions and 18 deletions

View file

@ -5,12 +5,7 @@ define(['knockout', '../../app/routes', '../../app/router', 'hasher'],
var self = this; var self = this;
// Load configs from variables defined in config.js // Load configs from variables defined in config.js
self.blogName = CONF_BLOG_NAME; _.merge(self, LAINE_CONFIG);
self.authorName = CONF_AUTHOR_NAME;
self.useDisqus = CONF_USE_DISQUS;
self.disqusShortname = CONF_DISQUS_SHORTNAME;
self.pageCommenting = CONF_PAGE_COMMENTING;
self.postsPerPage = CONF_POSTS_PER_PAGE;
} }
// This runs when the component is torn down. Put here any logic necessary to clean up, // This runs when the component is torn down. Put here any logic necessary to clean up,

View file

@ -1,20 +1,22 @@
// Example configuration for Laine // Example configuration for Laine
// Don't edit the names of the variables or the configuration won't work. // Don't edit the names of the variables or the configuration won't work.
// Blog name LAINE_CONFIG = {
CONF_BLOG_NAME = 'Laine'; // Blog name
blogName: 'Laine',
// Author name // Author name
CONF_AUTHOR_NAME = 'Nicd'; authorName: 'Nicd',
// Set to false to disable Disqus comments // Set to false to disable Disqus comments
CONF_USE_DISQUS = true; useDisqus: true,
// Disqus shortname for your site // Disqus shortname for your site
CONF_DISQUS_SHORTNAME = 'lainedemoblog'; disqusShortname: 'lainedemoblog',
// Set to true to show comments on pages in addition to posts // Set to true to show comments on pages in addition to posts
CONF_PAGE_COMMENTING = false; pageCommenting: false,
// Posts shown per page // Posts shown per page
CONF_POSTS_PER_PAGE = 5; postsPerPage: 5
};