Work on varTest
This commit is contained in:
parent
8361dabcf0
commit
c2c04cee12
9
app.js
9
app.js
@ -22,6 +22,15 @@ const srvPort = process.env.OWL_SRV_PORT || 8460
|
|||||||
// Print version number:
|
// Print version number:
|
||||||
console.log(`Starting OwlBoard - App Version: ${version.app} - API versions: ${version.api}`);
|
console.log(`Starting OwlBoard - App Version: ${version.app} - API versions: ${version.api}`);
|
||||||
|
|
||||||
|
// Test for required vars:
|
||||||
|
// const varTest = require('./src/utils/varTest.utils');
|
||||||
|
// var startTest = await varTest.varTest();
|
||||||
|
//console.log("Required Vars Missing:", startTest.missing_required);
|
||||||
|
//console.log("Desired Vars Missing:", startTest.missing_desired);
|
||||||
|
// if startTest.pass == false
|
||||||
|
// console.log("Unable to start, missing required vars")
|
||||||
|
// exit app
|
||||||
|
|
||||||
// Express Error Handling:
|
// Express Error Handling:
|
||||||
app.use((err, req, res, next) => {
|
app.use((err, req, res, next) => {
|
||||||
const statusCode = err.statuscode || 500;
|
const statusCode = err.statuscode || 500;
|
||||||
|
@ -1,2 +1,27 @@
|
|||||||
// Checks that all required environment variables are present.
|
// Checks that all required environment variables are present.
|
||||||
// Returns True or False and offers an object detailing what is missing.
|
// Returns True or False and offers an object detailing what is missing.
|
||||||
|
|
||||||
|
async function varTest(){
|
||||||
|
var required = {
|
||||||
|
OWL_LDB_KEY: process.env.OWL_LDB_KEY,
|
||||||
|
OWL_LDB_CORPUSUSER: process.env.OWL_LDB_CORPUSUSER,
|
||||||
|
OWL_LDB_CORPUSPASS: process.env.OWL_LDB_CORPUSPASS,
|
||||||
|
OWL_NOT_USED: process.env.OWL_NOT_USED
|
||||||
|
}
|
||||||
|
var desired = {
|
||||||
|
OWL_DB_PASS: process.env.OWL_DB_PASS
|
||||||
|
}
|
||||||
|
// DO NOT LOG CREDENTIALS!!!
|
||||||
|
|
||||||
|
// Test that each of required is NOT undefined.
|
||||||
|
// var pass = true if all okay, false if not.
|
||||||
|
// Append any missing values to missing_required = []
|
||||||
|
// Test that each of desired is NOT undefined.
|
||||||
|
// Append any missing values to missing_desired = []
|
||||||
|
|
||||||
|
// Return : {pass: $pass, missong_required = $missing_required, missing_desired = $missing_desired}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
varTest
|
||||||
|
}
|
Reference in New Issue
Block a user