Personal blog written from scratch using Node.js, Bootstrap, and MySQL. https://jrtechs.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
790 B

  1. const utils = require('../utils/utils');
  2. /**
  3. * @author Jeffery Russell 11-24-18
  4. *
  5. * @type {{main: module.exports.main}}
  6. */
  7. module.exports=
  8. {
  9. /**
  10. *
  11. * @returns {*|any}
  12. */
  13. getConfig: function()
  14. {
  15. const configContents = ["PORT", "SESSION_SECRET",
  16. "SQL_HOST", "SQL_DATABASE", "SQL_PASSWORD"];
  17. var config = utils.getFileAsJSON("./config.json");
  18. for(var i = 0; i < configContents.length; i++)
  19. {
  20. if(!config.hasOwnProperty(configContents[i]))
  21. {
  22. console.log("Missing config property: " + configContents[i]);
  23. process.exit(1);
  24. }
  25. }
  26. return config;
  27. }
  28. }