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
560 B

  1. "use strict";
  2. var fs = require('fs'),
  3. path = require('path'),
  4. _ = require('lodash');
  5. /**
  6. * Local Data Storage
  7. *
  8. * @param {Object} appconfig The application configuration
  9. */
  10. module.exports = (appconfig) => {
  11. // Create data directories
  12. try {
  13. fs.mkdirSync(appconfig.datadir.db);
  14. } catch (err) {
  15. if(err.code !== 'EEXIST') {
  16. winston.error(err);
  17. process.exit(1);
  18. }
  19. }
  20. try {
  21. fs.mkdirSync(path.join(appconfig.datadir.db, 'cache'));
  22. } catch (err) {
  23. if(err.code !== 'EEXIST') {
  24. winston.error(err);
  25. process.exit(1);
  26. }
  27. }
  28. };