diff options
author | Alan Pearce | 2017-10-08 11:18:37 +0200 |
---|---|---|
committer | Alan Pearce | 2017-10-08 11:18:37 +0200 |
commit | 6fcfcc550921ab43c00d323c172fd9d04211e53d (patch) | |
tree | 2220ab31af63a406f9c4f947e014b022408bf985 /src/app.js | |
parent | 529946dc5bdccc2153c97e2040953047319480f4 (diff) | |
download | homestead-2017.tar.lz homestead-2017.tar.zst homestead-2017.zip |
Allow config file to be specified 2017
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.
Diffstat (limited to 'src/app.js')
-rw-r--r-- | src/app.js | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/app.js b/src/app.js index 20ffb69..e9af4f5 100644 --- a/src/app.js +++ b/src/app.js @@ -8,25 +8,23 @@ const helmet = require("koa-helmet"); 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)); router.get( |