update deploy scripts

This commit is contained in:
Emily
2025-01-30 14:33:31 +01:00
parent a2e4ed9ee0
commit 0f39cab26a
3 changed files with 6 additions and 5 deletions

View File

@@ -24,8 +24,6 @@ winston-*.ndjson
.env.* .env.*
!.env.example !.env.example
ecosystem.config.js
# Test reports # Test reports
*.report.txt *.report.txt
@@ -36,5 +34,7 @@ out.pdf
tests tests
# EXPLAINS MONGODB # EXPLAINS MONGODB
explains
explains #Ecosystem
ecosystem.config.js

View File

@@ -13,7 +13,7 @@ export class DeployHelper {
const argvMode = process.argv[2] const argvMode = process.argv[2]
if (argvMode != '--production' && argvMode != '--testmode') { if (argvMode != '--production' && argvMode != '--testmode') {
console.error('use --production or --testmode'); console.error('use --production or --testmode');
process.exit(1); process.exit(0);
} }
const MODE = argvMode === '--production' ? 'production' : 'testmode'; const MODE = argvMode === '--production' ? 'production' : 'testmode';
return MODE; return MODE;

View File

@@ -26,7 +26,8 @@ async function main() {
if (MODE === 'testmode') { if (MODE === 'testmode') {
const ecosystemContent = fs.readFileSync(LOCAL_PATH + '/ecosystem.config.js', 'utf8'); const ecosystemContent = fs.readFileSync(LOCAL_PATH + '/ecosystem.config.js', 'utf8');
const devContent = ecosystemContent.replace("redis://litlyx.com", `redis://${REMOTE_HOST_TESTMODE}`); const REDIS_URL = ecosystemContent.match(/REDIS_URL: ["'](.*?)["']/)[1];
const devContent = ecosystemContent.replace(REDIS_URL, `redis://${REMOTE_HOST_TESTMODE}`);
archive.append(Buffer.from(devContent), { name: '/ecosystem.config.js' }); archive.append(Buffer.from(devContent), { name: '/ecosystem.config.js' });
} else { } else {
archive.file(LOCAL_PATH + '/ecosystem.config.js', { name: '/ecosystem.config.js' }) archive.file(LOCAL_PATH + '/ecosystem.config.js', { name: '/ecosystem.config.js' })