Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,24 @@ router.get('/', function(req, res, next) {
res.render('index', { title: 'Grafana SimpleJSON Value Mapper' });
});

/**
* Reload data.json
*/
router.post('/reload', isAuthorized, function(req, res, next) {

for (var k in require.cache) {

if (! k.match(/\/server\/data.json$/)) continue;

delete require.cache[k];
break;
}

data = require('../server/data.json');
res.end();
return;
});

/**
* This is the API endpoint that Grafana Simple JSON Datasources uses for metrics and template variables.
*/
Expand Down