1 | const fs = require('fs'); |
2 | const yaml = require('js-yaml'); |
3 | const pathFix = require('./pathFix'); |
4 |
|
5 | const config_path = 'misc/config.yaml'; |
6 | const config = yaml.safeLoad(fs.readFileSync(pathFix(config_path), 'utf-8')); |
7 |
|
8 | var templates = {}; |
9 | for (i in config.templates) { |
10 | template = config.templates[i]; |
11 | templates[template.name] = fs.readFileSync(pathFix(template.path), 'utf-8'); |
12 | } |
13 |
|
14 | var repositories = {}; |
15 | for (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 |
|
26 | module.exports = { |
27 | port: config["server-port"], |
28 | static: config.static, |
29 | templates: templates, |
30 | repositories: repositories |
31 | }; |
32 |
|