diff --git a/ormconfig.js b/ormconfig.js index 5ff4d06bb..070e0598c 100644 --- a/ormconfig.js +++ b/ormconfig.js @@ -1,6 +1,8 @@ const devConfig = { type: 'sqlite', - database: `${process.env.CONFIG_DIRECTORY || 'config'}/db/db.sqlite3`, + database: process.env.CONFIG_DIRECTORY + ? `${process.env.CONFIG_DIRECTORY}/db/db.sqlite3` + : 'config/db/db.sqlite3', synchronize: true, migrationsRun: false, logging: false, @@ -15,7 +17,9 @@ const devConfig = { const prodConfig = { type: 'sqlite', - database: `${process.env.CONFIG_DIRECTORY || 'config'}/db/db.sqlite3`, + database: process.env.CONFIG_DIRECTORY + ? `${process.env.CONFIG_DIRECTORY}/db/db.sqlite3` + : 'config/db/db.sqlite3', synchronize: false, logging: false, entities: ['dist/entity/**/*.js'], diff --git a/server/lib/settings.ts b/server/lib/settings.ts index 01e73b897..b9ad92a9f 100644 --- a/server/lib/settings.ts +++ b/server/lib/settings.ts @@ -137,11 +137,9 @@ interface AllSettings { notifications: NotificationSettings; } -const SETTINGS_PATH = path.join( - __dirname, - '../../', - `${process.env.CONFIG_DIRECTORY || '/config'}/settings.json` -); +const SETTINGS_PATH = process.env.CONFIG_DIRECTORY + ? `${process.env.CONFIG_DIRECTORY}/settings.json` + : path.join(__dirname, '../../config/settings.json'); class Settings { private data: AllSettings; diff --git a/server/logger.ts b/server/logger.ts index 014bd336b..824de630b 100644 --- a/server/logger.ts +++ b/server/logger.ts @@ -42,11 +42,9 @@ const logger = winston.createLogger({ ), }), new winston.transports.DailyRotateFile({ - filename: path.join( - __dirname, - '../', - `${process.env.CONFIG_DIRECTORY || '/config'}/logs/overseerr-%DATE%.log` - ), + filename: process.env.CONFIG_DIRECTORY + ? `${process.env.CONFIG_DIRECTORY}/logs/overseerr-%DATE%.log` + : path.join(__dirname, '../config/logs/overseerr-%DATE%.log'), datePattern: 'YYYY-MM-DD', zippedArchive: true, maxSize: '20m',