Skip to content

Commit

Permalink
feat(server): add CONFIG_DIRECTORY env var to control config director…
Browse files Browse the repository at this point in the history
…y location
  • Loading branch information
sct committed Jan 18, 2021
1 parent b0ce040 commit fa8f112
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ormconfig.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const devConfig = {
type: 'sqlite',
database: 'config/db/db.sqlite3',
database: `${process.env.CONFIG_DIRECTORY || 'config'}/db/db.sqlite3`,
synchronize: true,
migrationsRun: false,
logging: false,
Expand All @@ -15,7 +15,7 @@ const devConfig = {

const prodConfig = {
type: 'sqlite',
database: 'config/db/db.sqlite3',
database: `${process.env.CONFIG_DIRECTORY || 'config'}/db/db.sqlite3`,
synchronize: false,
logging: false,
entities: ['dist/entity/**/*.js'],
Expand Down
6 changes: 5 additions & 1 deletion server/lib/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ interface AllSettings {
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 {
private data: AllSettings;
Expand Down
6 changes: 5 additions & 1 deletion server/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ const logger = winston.createLogger({
),
}),
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',
zippedArchive: true,
maxSize: '20m',
Expand Down

0 comments on commit fa8f112

Please sign in to comment.