00checkStartup.js 914 B

1234567891011121314151617181920212223242526
  1. const fs = require('fs');
  2. const os = require('os');
  3. let errors = [];
  4. if (!process.env.WRITABLE_PATH) {
  5. errors.push("WRITABLE_PATH environment variable missing and/or unset, please configure !");
  6. } else {
  7. try {
  8. fs.accessSync(process.env.WRITABLE_PATH, fs.constants.W_OK);
  9. } catch (err) {
  10. const userInfo = os.userInfo();
  11. errors.push("can't write to " + process.env.WRITABLE_PATH, err);
  12. errors.push("the path of WRITABLE_PATH (" + process.env.WRITABLE_PATH + ") must be writable !!!");
  13. errors.push("username: " + userInfo["username"] + " - uid: " + userInfo["uid"] + " - gid: " + userInfo["gid"]);
  14. }
  15. }
  16. if (errors.length > 0) {
  17. console.error("\n\n");
  18. console.error(errors.join("\n"));
  19. console.error("\n");
  20. console.error("Stopping Wekan");
  21. console.error("Wekan isn't runnable. Please resolve the error's above and restart Wekan !");
  22. console.error("\n\n");
  23. process.exit(1);
  24. }