about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorAlan Pearce2017-06-18 20:07:14 +0200
committerAlan Pearce2017-06-18 20:07:14 +0200
commit2fef943bf1c52e8d2be64521202936ca0f7358e3 (patch)
treeef839e7442e7a996dc3f8c918529a500b7efa53e /src
parente13c5726846a89df4196f6abc9fc98d99d48305b (diff)
downloadhomestead-2fef943bf1c52e8d2be64521202936ca0f7358e3.tar.lz
homestead-2fef943bf1c52e8d2be64521202936ca0f7358e3.tar.zst
homestead-2fef943bf1c52e8d2be64521202936ca0f7358e3.zip
feat: use configly/TOML for configuration
Diffstat (limited to 'src')
-rw-r--r--src/index.js8
-rw-r--r--src/modules/config.js10
2 files changed, 15 insertions, 3 deletions
diff --git a/src/index.js b/src/index.js
index 242b298..6df1530 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,17 +1,19 @@
 'use strict'
 
-const PORT = process.env.PORT || 3000
-
 const Koa = require('koa')
 const app = new Koa()
 
+const config = require('./modules/config.js')
+
+const PORT = process.env.PORT || config.server.port
+
 const Router = require('koa-router')
 const router = new Router()
 
 const view = require('koa-nunjucks-next')
 
 const Posts = require('./modules/posts.js')
-const posts = Posts.getFolder(process.env.POST_DIR)
+const posts = Posts.getFolder(config.posts.folder)
 
 app.use(
   view(`${__dirname}/views`, {
diff --git a/src/modules/config.js b/src/modules/config.js
new file mode 100644
index 0000000..461945d
--- /dev/null
+++ b/src/modules/config.js
@@ -0,0 +1,10 @@
+'use strict'
+
+const TOML = require('toml')
+const config = require('configly')
+
+module.exports = config({
+  parsers: {
+    toml: TOML.parse
+  }
+})