Create SQLite directory before app startup
This commit is contained in:
@@ -3,7 +3,7 @@ import { ValidationPipe } from '@nestjs/common';
|
||||
import { HttpExceptionFilter } from './shared/filters/http-exception.filter';
|
||||
import { AppModule } from './app.module';
|
||||
import * as fs from 'fs';
|
||||
import { resolve } from 'path';
|
||||
import { dirname, resolve } from 'path';
|
||||
import { spawn } from 'child_process';
|
||||
import helmet from 'helmet';
|
||||
import { EnvironmentEnum } from './environmentEnum';
|
||||
@@ -17,11 +17,17 @@ async function bootstrap() {
|
||||
throw new Error('DOWNLOADS_PATH environment variable is missing');
|
||||
}
|
||||
|
||||
const folderName = resolve(
|
||||
const downloadsPath = resolve(
|
||||
__dirname,
|
||||
process.env[EnvironmentEnum.DOWNLOADS_PATH],
|
||||
);
|
||||
fs.mkdirSync(folderName, { recursive: true });
|
||||
fs.mkdirSync(downloadsPath, { recursive: true });
|
||||
|
||||
const dbPath = resolve(
|
||||
__dirname,
|
||||
process.env[EnvironmentEnum.DB_PATH] || './config/db.sqlite',
|
||||
);
|
||||
fs.mkdirSync(dirname(dbPath), { recursive: true });
|
||||
|
||||
if (envFlag(EnvironmentEnum.REDIS_RUN)) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user