aboutsummaryrefslogtreecommitdiffstats
path: root/src/internal-server/start.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/internal-server/start.js')
-rw-r--r--src/internal-server/start.js17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/internal-server/start.js b/src/internal-server/start.js
index adcac0bec..683f24651 100644
--- a/src/internal-server/start.js
+++ b/src/internal-server/start.js
@@ -14,22 +14,22 @@
14| Also you can preload files by calling `preLoad('path/to/file')` method. 14| Also you can preload files by calling `preLoad('path/to/file')` method.
15| Make sure to pass a relative path from the project root. 15| Make sure to pass a relative path from the project root.
16*/ 16*/
17process.env.FERDI_VERSION = '5.4.0-beta.5';
18 17
19const path = require('path'); 18const fold = require('@adonisjs/fold');
19const { Ignitor } = require('@adonisjs/ignitor');
20const fs = require('fs-extra'); 20const fs = require('fs-extra');
21const os = require('os'); 21const os = require('os');
22const path = require('path');
23const packageJSON = require('../../package.json');
22 24
25process.env.FERDI_VERSION = packageJSON.version;
23process.env.ENV_PATH = path.join(__dirname, 'env.ini'); 26process.env.ENV_PATH = path.join(__dirname, 'env.ini');
24 27
25const { Ignitor } = require('@adonisjs/ignitor');
26const fold = require('@adonisjs/fold');
27
28module.exports = async (userPath, port) => { 28module.exports = async (userPath, port) => {
29 const dbPath = path.join(userPath, 'server.sqlite'); 29 const dbPath = path.join(userPath, 'server.sqlite');
30 const dbTemplatePath = path.join(__dirname, 'database', 'template.sqlite'); 30 const dbTemplatePath = path.join(__dirname, 'database', 'template.sqlite');
31 31
32 if (!await fs.exists(dbPath)) { 32 if (!fs.existsSync(dbPath)) {
33 // Manually copy file 33 // Manually copy file
34 // We can't use copyFile here as it will cause the file to be readonly on Windows 34 // We can't use copyFile here as it will cause the file to be readonly on Windows
35 const dbTemplate = await fs.readFile(dbTemplatePath); 35 const dbTemplate = await fs.readFile(dbTemplatePath);
@@ -46,8 +46,5 @@ module.exports = async (userPath, port) => {
46 process.env.USER_PATH = userPath; 46 process.env.USER_PATH = userPath;
47 process.env.PORT = port; 47 process.env.PORT = port;
48 48
49 new Ignitor(fold) 49 new Ignitor(fold).appRoot(__dirname).fireHttpServer().catch(console.error); // eslint-disable-line no-console
50 .appRoot(__dirname)
51 .fireHttpServer()
52 .catch(console.error); // eslint-disable-line no-console
53}; 50};