Ver código fonte

Поправки конфигов

Book Pauk 6 anos atrás
pai
commit
4c3f175e71
3 arquivos alterados com 12 adições e 9 exclusões
  1. 5 8
      server/config/base.js
  2. 1 1
      server/config/config.js
  3. 6 0
      server/config/production.js

+ 5 - 8
server/config/base.js

@@ -1,12 +1,9 @@
-const path = require('path');
-const fs = require('fs');
-
-const packageObj = JSON.parse(fs.readFileSync(__dirname + '/../../package.json', 'utf8'));
-const execPath = path.dirname(process.execPath);
+const pckg = require('../../package.json');
+const execPath = __dirname + '/..';
 
 
 module.exports = {
 module.exports = {
     branch: 'base',
     branch: 'base',
-    tempDir: execPath +'/tmp',
+    tempDir: execPath + '/tmp',
     logDir: execPath + '/log',
     logDir: execPath + '/log',
     dataDir: execPath + '/data',
     dataDir: execPath + '/data',
     dbFileName: 'db.sqlite',
     dbFileName: 'db.sqlite',
@@ -15,7 +12,7 @@ module.exports = {
     port: '33080',
     port: '33080',
     ip: '127.0.0.1',
     ip: '127.0.0.1',
 
 
-    version: packageObj.version,
-    name: packageObj.name,
+    version: pckg.version,
+    name: pckg.name,
 };
 };
 
 

+ 1 - 1
server/config/config.js

@@ -1,6 +1,6 @@
 const fs = require('fs');
 const fs = require('fs');
 
 
-const branchFilename = __dirname + '/../application_env';
+const branchFilename = __dirname + '/application_env';
 
 
 let branch = 'production';
 let branch = 'production';
 try {
 try {

+ 6 - 0
server/config/production.js

@@ -1,6 +1,12 @@
+const path = require('path');
 const base = require('./base');
 const base = require('./base');
 
 
+const execPath = path.dirname(process.execPath);
+
 module.exports = Object.assign({}, base, {
 module.exports = Object.assign({}, base, {
         branch: 'production',
         branch: 'production',
+        tempDir: execPath + '/tmp',
+        logDir: execPath + '/log',
+        dataDir: execPath + '/data',
     }
     }
 );
 );