Allow config file to be specified Currently via environment variable, but for now that's fine as the only use that I can forsee is for testing, where the plumbing is more important than the interface.
1 file changed, 7 insertions(+), 9 deletions(-)
changed files
M src/app.js → src/app.js
@@ -8,23 +8,21 @@ const actions = require("./actions.js"); const responders = require("./responders.js"); -const config = require("./modules/config.js"); - const Router = require("koa-router"); const router = new Router(); const makeTagURI = (authority, startDate) => specific => `tag:${authority},${startDate}:${specific}`; -app.context.makeTagURI = makeTagURI( - config.feed.originalDomainName, - config.feed.domainStartDate -); -app.context.getURL = router.url.bind(router); - -module.exports = async function() { +module.exports = async function(config) { const Posts = await require("./domain/posts.js")(config.posts, basename => router.url("post", basename) + ); + + app.context.getURL = router.url.bind(router); + app.context.makeTagURI = makeTagURI( + config.feed.originalDomainName, + config.feed.domainStartDate ); router.get("home", "/", actions.home(config, responders.home, Posts.posts));