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 = { const devConfig = {
type: 'sqlite', 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, synchronize: true,
migrationsRun: false, migrationsRun: false,
logging: false, logging: false,
@ -15,7 +17,9 @@ const devConfig = {
const prodConfig = { const prodConfig = {
type: 'sqlite', 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, synchronize: false,
logging: false, logging: false,
entities: ['dist/entity/**/*.js'], entities: ['dist/entity/**/*.js'],

@ -137,11 +137,9 @@ interface AllSettings {
notifications: NotificationSettings; notifications: NotificationSettings;
} }
const SETTINGS_PATH = path.join( const SETTINGS_PATH = process.env.CONFIG_DIRECTORY
__dirname, ? `${process.env.CONFIG_DIRECTORY}/settings.json`
'../../', : path.join(__dirname, '../../config/settings.json');
`${process.env.CONFIG_DIRECTORY || '/config'}/settings.json`
);
class Settings { class Settings {
private data: AllSettings; private data: AllSettings;

@ -42,11 +42,9 @@ const logger = winston.createLogger({
), ),
}), }),
new winston.transports.DailyRotateFile({ new winston.transports.DailyRotateFile({
filename: path.join( filename: process.env.CONFIG_DIRECTORY
__dirname, ? `${process.env.CONFIG_DIRECTORY}/logs/overseerr-%DATE%.log`
'../', : path.join(__dirname, '../config/logs/overseerr-%DATE%.log'),
`${process.env.CONFIG_DIRECTORY || '/config'}/logs/overseerr-%DATE%.log`
),
datePattern: 'YYYY-MM-DD', datePattern: 'YYYY-MM-DD',
zippedArchive: true, zippedArchive: true,
maxSize: '20m', maxSize: '20m',

Loading…
Cancel
Save