aboutsummaryrefslogtreecommitdiffstats
path: root/src/internal-server/start.ts
diff options
context:
space:
mode:
authorLibravatar Markus Hatvan <markus_hatvan@aon.at>2021-10-14 13:24:58 +0200
committerLibravatar GitHub <noreply@github.com>2021-10-14 13:24:58 +0200
commitfe1ba2ad6affeb6c0e97c73171d8fa3f31dde73e (patch)
tree10caa332d957421e982c7ddd0c94623d5d62314d /src/internal-server/start.ts
parentchore: convert various JS to TS (#2062) (diff)
downloadferdium-app-fe1ba2ad6affeb6c0e97c73171d8fa3f31dde73e.tar.gz
ferdium-app-fe1ba2ad6affeb6c0e97c73171d8fa3f31dde73e.tar.zst
ferdium-app-fe1ba2ad6affeb6c0e97c73171d8fa3f31dde73e.zip
chore: convert files to TS (#2066)
Diffstat (limited to 'src/internal-server/start.ts')
-rw-r--r--src/internal-server/start.ts18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/internal-server/start.ts b/src/internal-server/start.ts
index 392f7cf41..62311b21e 100644
--- a/src/internal-server/start.ts
+++ b/src/internal-server/start.ts
@@ -17,27 +17,27 @@
17 17
18import fold from '@adonisjs/fold'; 18import fold from '@adonisjs/fold';
19import { Ignitor } from '@adonisjs/ignitor'; 19import { Ignitor } from '@adonisjs/ignitor';
20import fs from 'fs-extra'; 20import { existsSync, readFile, statSync, chmodSync, writeFile } from 'fs-extra';
21import path from 'path'; 21import { join } from 'path';
22import { LOCAL_HOSTNAME } from '../config'; 22import { LOCAL_HOSTNAME } from '../config';
23import { isWindows } from '../environment'; 23import { isWindows } from '../environment';
24 24
25process.env.ENV_PATH = path.join(__dirname, 'env.ini'); 25process.env.ENV_PATH = join(__dirname, 'env.ini');
26 26
27export const server = async (userPath: string, port: number) => { 27export const server = async (userPath: string, port: number) => {
28 const dbPath = path.join(userPath, 'server.sqlite'); 28 const dbPath = join(userPath, 'server.sqlite');
29 const dbTemplatePath = path.join(__dirname, 'database', 'template.sqlite'); 29 const dbTemplatePath = join(__dirname, 'database', 'template.sqlite');
30 30
31 if (!fs.existsSync(dbPath)) { 31 if (!existsSync(dbPath)) {
32 // Manually copy file 32 // Manually copy file
33 // We can't use copyFile here as it will cause the file to be readonly on Windows 33 // We can't use copyFile here as it will cause the file to be readonly on Windows
34 const dbTemplate = await fs.readFile(dbTemplatePath); 34 const dbTemplate = await readFile(dbTemplatePath);
35 await fs.writeFile(dbPath, dbTemplate); 35 await writeFile(dbPath, dbTemplate);
36 36
37 // Change permissions to ensure to file is not read-only 37 // Change permissions to ensure to file is not read-only
38 if (isWindows) { 38 if (isWindows) {
39 // eslint-disable-next-line no-bitwise 39 // eslint-disable-next-line no-bitwise
40 fs.chmodSync(dbPath, fs.statSync(dbPath).mode | 146); 40 chmodSync(dbPath, statSync(dbPath).mode | 146);
41 } 41 }
42 } 42 }
43 43