Prepare for LDBSV

This commit is contained in:
Fred Boniface 2023-06-11 19:42:39 +01:00
parent aab3e00eac
commit 43fd6db4b9
3 changed files with 7 additions and 9 deletions

View File

@ -1,4 +0,0 @@
# What to do next:
* Rewrite sanitizing functions to remove external dependancy.
* Change /api/v1/auth endpoints to /api/v1/register endpoints - auth is done in middleware

12
app.js
View File

@ -4,8 +4,6 @@
// licensed separately, each folder contains a license file where a // licensed separately, each folder contains a license file where a
// different license applies. // different license applies.
/* global process */
console.log('Initialising OwlBoard'); console.log('Initialising OwlBoard');
const mode = process.env.NODE_ENV || 'development'; const mode = process.env.NODE_ENV || 'development';
@ -23,6 +21,7 @@ const log = require('./src/utils/log.utils');
const version = require('./src/configs/version.configs'); const version = require('./src/configs/version.configs');
const listRtr = require('./src/routes/list.routes'); const listRtr = require('./src/routes/list.routes');
const ldbRtr = require('./src/routes/ldb.routes'); const ldbRtr = require('./src/routes/ldb.routes');
const ldbsRtr = require('./src/routes/ldbs.routes');
const kubeRtr = require('./src/routes/kube.routes'); const kubeRtr = require('./src/routes/kube.routes');
const findRtr = require('./src/routes/find.routes'); const findRtr = require('./src/routes/find.routes');
const issueRtr = require('./src/routes/issue.routes'); const issueRtr = require('./src/routes/issue.routes');
@ -79,10 +78,13 @@ app.use('/api/v1/stats', statRtr);
app.use('/api/v1/register', regRtr); app.use('/api/v1/register', regRtr);
// Authented Routes // Authented Routes
app.use('/api/v1/ldbs', authenticate, (req, res) => res.status(501).json({status: 'not implemented'})); app.use('/api/v1/ldbs', authenticate, ldbsRtr);
app.use('/api/v1/pis', authenticate, pisRtr); app.use('/api/v1/pis', authenticate, pisRtr);
app.use('/api/v1/auth/test', authenticate, (req, res) => res.status(200).json({status: 'ok', message: 'Authentication successful'})); // Returns 401 if auth failed, 200 if successful. app.use('/api/v1/auth/test', authenticate, (req, res) => res.status(200).json({
app.use('/api/v1/train', /*authenticate,*/ trainRtr); // Disable authentication during testing status: 'ok',
message: 'Authentication successful'
})); // Returns 401 if auth failed, 200 if successful.
app.use('/api/v1/train', authenticate, trainRtr);
// Number of proxies: // Number of proxies:
app.set('trust proxy', 4); app.set('trust proxy', 4);