-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathschema.js
More file actions
32 lines (28 loc) · 923 Bytes
/
schema.js
File metadata and controls
32 lines (28 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const Logger = require("./logger.js");
const fs = require("fs-extra");
const path = require("path");
const handlebars = require("handlebars");
function getEmpty() {
return fs.readFile(path.join(__dirname, "schema.sql"), "utf-8");
}
function getTemplated(mainPass, helperPass, renewerPass, supportPass, partnerPass, webhookPass, debugPass) {
return fs.readFile(path.join(__dirname, "schema.sql"), "utf-8")
.then( schema => {
Logger.info("Read schema from disk.");
var template = handlebars.compile(schema);
const filledTemplate = template({
main_password: mainPass,
helper_password: helperPass,
renewer_password: renewerPass,
support_password: supportPass,
partner_password: partnerPass,
webhook_password: webhookPass,
debug_password: debugPass
});
return filledTemplate;
});
}
module.exports = {
getTemplated: getTemplated,
getEmpty: getEmpty
}