2017-09-02 08:04:47 +02:00
|
|
|
/**
|
|
|
|
* Created by cmiles on 8/9/2017.
|
|
|
|
*/
|
|
|
|
|
|
|
|
var express = require('express');
|
|
|
|
var router = express.Router();
|
|
|
|
|
|
|
|
router.get('/', function(req, res, next) {
|
|
|
|
|
|
|
|
var json_file = require('jsonfile');
|
|
|
|
glass_config = json_file.readFileSync('config/glass_config.json');
|
|
|
|
|
|
|
|
res.setHeader('Content-Type', 'application/json');
|
|
|
|
|
|
|
|
const execSync = require('child_process').execSync;
|
|
|
|
output = execSync('./bin/dhcpd-pools -c ' + glass_config.config_file + ' -l ' + glass_config.leases_file + ' -f j -A -s e');
|
|
|
|
|
2017-09-15 12:23:02 +02:00
|
|
|
// console.log(JSON.parse(output));
|
2017-09-02 08:04:47 +02:00
|
|
|
|
|
|
|
res.send(JSON.stringify(JSON.parse(output)));
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = router;
|