art round 1

This commit is contained in:
2022-09-25 14:01:47 -04:00
commit 13732b1071
13 changed files with 5076 additions and 0 deletions

12
nodejs/conf/base.js Normal file
View File

@ -0,0 +1,12 @@
module.exports = {
"mc": {
"server": "corejourney.org._vAUTO.mc.proxy",
"bots": {
"bot_name": {
"username": "<configure in secrets>",
"password": "<configure in secrets>",
'auth': "microsoft"
}
}
}
}

32
nodejs/conf/index.js Normal file
View File

@ -0,0 +1,32 @@
'use strict';
const extend = require('extend');
const environment = process.env.NODE_ENV || 'development';
function load(filePath, required){
try {
return require(filePath);
} catch(error){
if(error.name === 'SyntaxError'){
console.error(`Loading ${filePath} file failed!\n`, error);
process.exit(1);
} else if (error.code === 'MODULE_NOT_FOUND'){
console.warn(`No config file ${filePath} FOUND! This may cause issues...`);
if (required){
process.exit(1);
}
return {};
}else{
console.dir(`Unknown error in loading ${filePath} config file.\n`, error);
}
}
};
module.exports = extend(
true, // enable deep copy
load('./base', true),
load(`./${environment}`),
load('./secrets'),
{environment}
);