mirror of
https://github.com/wekan/wekan.git
synced 2026-01-23 17:56:09 +01:00
enable/disable api with env var
This commit is contained in:
parent
dafe1e39a5
commit
6173a73381
5 changed files with 23 additions and 3 deletions
|
|
@ -622,9 +622,20 @@ if (Meteor.isServer) {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
// USERS REST API
|
||||
if (Meteor.isServer) {
|
||||
// Middleware which checks that API is enabled.
|
||||
JsonRoutes.Middleware.use(function (req, res, next) {
|
||||
const api = req.url.search('api');
|
||||
if (api === 1 && process.env.WITH_API === 'true' || api === -1){
|
||||
return next();
|
||||
}
|
||||
else {
|
||||
res.writeHead(301, {Location: '/'});
|
||||
return res.end();
|
||||
}
|
||||
});
|
||||
|
||||
JsonRoutes.add('GET', '/api/user', function(req, res) {
|
||||
try {
|
||||
Authentication.checkLoggedIn(req.userId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue