feat(server): add CONFIG_DIRECTORY env var to control config directory location

This commit is contained in:
sct
2021-01-18 01:15:08 +00:00
parent b0ce0406bb
commit fa8f112c31
3 changed files with 12 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
const devConfig = { const devConfig = {
type: 'sqlite', type: 'sqlite',
database: 'config/db/db.sqlite3', database: `${process.env.CONFIG_DIRECTORY || 'config'}/db/db.sqlite3`,
synchronize: true, synchronize: true,
migrationsRun: false, migrationsRun: false,
logging: false, logging: false,
@@ -15,7 +15,7 @@ const devConfig = {
const prodConfig = { const prodConfig = {
type: 'sqlite', type: 'sqlite',
database: 'config/db/db.sqlite3', database: `${process.env.CONFIG_DIRECTORY || 'config'}/db/db.sqlite3`,
synchronize: false, synchronize: false,
logging: false, logging: false,
entities: ['dist/entity/**/*.js'], entities: ['dist/entity/**/*.js'],

View File

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

View File

@@ -42,7 +42,11 @@ const logger = winston.createLogger({
), ),
}), }),
new winston.transports.DailyRotateFile({ new winston.transports.DailyRotateFile({
filename: path.join(__dirname, '../config/logs/overseerr-%DATE%.log'), filename: path.join(
__dirname,
'../',
`${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',