index.js 685 B

123456789101112131415161718192021222324252627282930
  1. /**
  2. * 安全插件
  3. * @class
  4. */
  5. class SecurityAddon {
  6. constructor(app) {
  7. this.app = app;
  8. }
  9. /**
  10. * 创建
  11. */
  12. create () {
  13. this.app.console.info('[addon:security] load');
  14. const runWithDebug = process.argv.find(function(e){
  15. let isHasDebug = e.includes("--inspect") || e.includes("--inspect-brk") || e.includes("--remote-debugging-port");
  16. return isHasDebug;
  17. })
  18. // 不允许远程调试
  19. if (runWithDebug) {
  20. this.app.logger.error('[error] Remote debugging is not allowed, runWithDebug:', runWithDebug);
  21. this.app.appQuit();
  22. }
  23. }
  24. }
  25. SecurityAddon.toString = () => '[class SecurityAddon]';
  26. module.exports = SecurityAddon;