Index

joshstock.in / baaa825

Source for serving and static templating/compiling of https://joshstock.in.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
7320 Jan 2020 21:499b4a3f1Begin gitpager rewriteJosh Stockin1310N

Blob @ joshstock.in / gitpager / src / config.js

application/javascript859 bytesdownload raw
1const fs = require('fs');
2const yaml = require('js-yaml');
3const pathFix = require('./pathFix');
4
5const config_path = 'misc/config.yaml';
6const config = yaml.safeLoad(fs.readFileSync(pathFix(config_path), 'utf-8'));
7
8var templates = {};
9for (i in config.templates) {
10 template = config.templates[i];
11 templates[template.name] = fs.readFileSync(pathFix(template.path), 'utf-8');
12}
13
14var repositories = {};
15for (i in config.repositories) {
16 repository = config.repositories[i];
17 repositories[repository.name] = {
18 description: repository.description,
19 branch: repository.branch,
20 branches: repository.allows,
21 github: repository.github,
22 location: repository.location[process.env.NODE_ENV == "production" ? "prod" : "dev"]
23 };
24}
25
26module.exports = {
27 port: config["server-port"],
28 static: config.static,
29 templates: templates,
30 repositories: repositories
31};
32