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;
// Load configs from variables defined in config.js
self.blogName = CONF_BLOG_NAME;
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;
_.merge(self, LAINE_CONFIG);
}
// 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
// Don't edit the names of the variables or the configuration won't work.
// Blog name
CONF_BLOG_NAME = 'Laine';
LAINE_CONFIG = {
// Blog name
blogName: 'Laine',
// Author name
CONF_AUTHOR_NAME = 'Nicd';
// Author name
authorName: 'Nicd',
// Set to false to disable Disqus comments
CONF_USE_DISQUS = true;
// Set to false to disable Disqus comments
useDisqus: true,
// Disqus shortname for your site
CONF_DISQUS_SHORTNAME = 'lainedemoblog';
// Disqus shortname for your site
disqusShortname: 'lainedemoblog',
// Set to true to show comments on pages in addition to posts
CONF_PAGE_COMMENTING = false;
// Set to true to show comments on pages in addition to posts
pageCommenting: false,
// Posts shown per page
CONF_POSTS_PER_PAGE = 5;
// Posts shown per page
postsPerPage: 5
};