fix(server): support absolute paths for CONFIG_DIRECTORY

pull/602/head
sct 4 years ago
parent fa8f112c31
commit 51d8fba916

@ -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'],

@ -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;

@ -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',

Loading…
Cancel
Save