glass-isc-dhcp/routes/dhcp_config.js

26 lines
930 B
JavaScript

var express = require('express');
var router = express.Router();
var fs = require('fs');
var template_render = require('../lib/render_template.js');
router.get('/', function(req, res, next) {
var content = "";
content = template_render.get_template("dhcp_config");
/* Read Config */
var json_file = require('jsonfile');
var glass_config = json_file.readFileSync('config/glass_config.json');
content = template_render.set_template_variable(content, "title", "DHCP Config");
content = template_render.set_template_variable(content, "c_content", "");
content = template_render.set_template_variable(content, "dhcp_config_location", glass_config.config_file);
var dhcp_config = fs.readFileSync(glass_config.config_file, 'utf8');
content = template_render.set_template_variable(content, "dhcp_config_content", dhcp_config);
res.send(template_render.get_index_template(content, req.url));
});
module.exports = router;