Add support for running in production with dev.js config, node index --prod-with-dev-env

This commit is contained in:
advplyr 2025-06-26 17:21:58 -05:00
parent d21fe49ce2
commit e384863148
2 changed files with 5 additions and 2 deletions

View file

@ -4,7 +4,9 @@ const optionDefinitions = [
{ name: 'port', alias: 'p', type: String },
{ name: 'host', alias: 'h', type: String },
{ name: 'source', alias: 's', type: String },
{ name: 'dev', alias: 'd', type: Boolean }
{ name: 'dev', alias: 'd', type: Boolean },
// Run in production mode and use dev.js config
{ name: 'prod-with-dev-env', alias: 'r', type: Boolean }
]
const commandLineArgs = require('./server/libs/commandLineArgs')
@ -17,7 +19,7 @@ const server = require('./server/Server')
global.appRoot = __dirname
const isDev = process.env.NODE_ENV !== 'production'
if (isDev) {
if (isDev || options['prod-with-dev-env']) {
const devEnv = require('./dev').config
if (devEnv.Port) process.env.PORT = devEnv.Port
if (devEnv.ConfigPath) process.env.CONFIG_PATH = devEnv.ConfigPath

View file

@ -7,6 +7,7 @@
"scripts": {
"dev": "nodemon --watch server index.js -- --dev",
"start": "node index.js",
"start-dev": "node index.js --prod-with-dev-env",
"client": "cd client && npm ci && npm run generate",
"prod": "npm run client && npm ci && node index.js",
"build-win": "npm run client && pkg -t node20-win-x64 -o ./dist/win/audiobookshelf -C GZip .",