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.

34 lines
670 B

  1. "use strict";
  2. var fs = require('fs'),
  3. yaml = require('js-yaml'),
  4. _ = require('lodash');
  5. /**
  6. * Load Application Configuration
  7. *
  8. * @param {String} confPath Path to the configuration file
  9. * @return {Object} Application Configuration
  10. */
  11. module.exports = (confPath) => {
  12. var appconfig = {};
  13. try {
  14. appconfig = yaml.safeLoad(fs.readFileSync(confPath, 'utf8'));
  15. } catch (ex) {
  16. winston.error(ex);
  17. process.exit(1);
  18. }
  19. return _.defaultsDeep(appconfig, {
  20. title: "Requarks Wiki",
  21. host: "http://localhost",
  22. port: process.env.PORT,
  23. wsPort: 8080,
  24. db: "mongodb://localhost/wiki",
  25. redis: null,
  26. sessionSecret: null,
  27. admin: null
  28. });
  29. };