Skip to content

Commit

Permalink
minor changes spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
ansibleguy76 committed Jan 11, 2025
1 parent 18329f8 commit c8e22a1
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
3 changes: 2 additions & 1 deletion server/src/configure.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// load the .env.development file ; it loads a bunch of environment variables
// we are not doing this for production, where the variables are coming from the actual environment
if ((process.env.NODE_ENV || "production") !== 'production' || process.env.FORCE_DOTENV==1 || process.env.FORCE_DOTENV=="1" ){
if (process.env.NODE_ENV !== 'production' || process.env.FORCE_DOTENV==1 || process.env.FORCE_DOTENV=="1" ){
console.log(`Importing .env file : ${__dirname}/../.env.${process.env.NODE_ENV}` )
require('dotenv').config({ path: `${__dirname}/../.env.${process.env.NODE_ENV}` })
}
Expand All @@ -20,6 +20,7 @@ const swaggerDocument = require('./swagger.json');
const bodyParser = require('body-parser');
// a plugin to help with authentication and authorization
const passport = require('passport');

// a small custom middleware to check whether the user has access to routes
const checkSettingsMiddleware = require('./lib/common').checkSettingsMiddleware
const checkLogsMiddleware = require('./lib/common').checkLogsMiddleware
Expand Down
2 changes: 1 addition & 1 deletion server/src/controllers/credential.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ exports.update = function(req, res) {
res.status(400).send({ error:true, message: 'Please provide all required fields' });
}else{
Credential.update(new Credential(req.body),req.params.id)
.then((credential)=>{res.json(new RestResult("success","credential updated",null,""))})
.then(()=>{res.json(new RestResult("success","credential updated",null,""))})
.catch((err)=>{ res.json(new RestResult("error","failed to update credential",null,err.toString())) })
}
};
Expand Down
2 changes: 1 addition & 1 deletion server/src/controllers/repository.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ exports.reset = function(req, res) {
Repository.reset(req.params.name)
.then(()=>{res.json(new RestResult("success","repository reset",null,""))})
.catch((err)=>{ res.json(new RestResult("error","failed to reset repository",null,err.toString())) })
};
};
exports.pull = function(req, res) {
Repository.pull(req.params.name)
.then(()=>{res.json(new RestResult("success","repository pulled",null,""))})
Expand Down
1 change: 0 additions & 1 deletion server/src/db/create_oidc_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ CREATE TABLE `oidc` (
`enabled` tinyint(4) DEFAULT NULL,
`groupfilter` varchar(250) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

5 changes: 2 additions & 3 deletions server/src/functions/default.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

// export default functions that are handy and usable with the javascrip expression field
// expand if you need, you will to do a rebuild
// export default functions that are handy and usable with the javascrip expression field
// expand if you need, you will to do a rebuild
const https=require('https')
const axios=require("axios")
const fs = require("fs")
Expand Down
20 changes: 10 additions & 10 deletions server/src/lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ Helpers.checkCertificate=function(cert){
}
// a middleware in the routes to check if use is administrator
Helpers.checkAdminMiddleware = (req, res, next) => {
try{
if(!req.user.user.roles.includes("admin")) {
res.status(401).json(new restResult("error","No access",null,"You are not an admin"))
} else {
//logger.debug("You are admin, access to user management")
next()
}
}catch(e){
res.status(401).json(new restResult("error","No access",null,"You are not an admin"))
}
try{
if(!req.user.user.roles.includes("admin")) {
res.status(401).json(new restResult("error","No access",null,"You are not an admin"))
} else {
//logger.debug("You are admin, access to user management")
next()
}
}catch(e){
res.status(401).json(new restResult("error","No access",null,"You are not an admin"))
}
}
Helpers.checkSettingsMiddleware = (req, res, next) => {
try {
Expand Down

0 comments on commit c8e22a1

Please sign in to comment.