Refactor database environment variable usage across workflows and application code
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 3m53s

- Updated Gitea workflows to standardize on `DB_NAME` instead of `DB_DATABASE` for database name references.
- Modified deployment, backup, reset, and restore workflows to ensure consistent environment variable usage.
- Removed dotenv dependency and preload script, transitioning to environment variable management directly in scripts.
- Adjusted application code to utilize `DB_NAME` for database connections and logging.
- Enhanced README to reflect changes in environment variable configuration and usage.
- Cleaned up package.json scripts to remove unnecessary preload references.
This commit is contained in:
2025-12-04 18:02:38 -08:00
parent 80d2b1ffe6
commit 9d552b7456
22 changed files with 127 additions and 176 deletions

View File

@@ -7,10 +7,8 @@ module.exports = {
apps: [
{
name: 'flyer-crawler-api', // The name of our API application in PM2
// Use tsx as the interpreter and pass the preload script via node_args.
script: './node_modules/.bin/tsx',
args: 'server.ts',
node_args: '-r ./preload.ts',
args: 'server.ts', // tsx will execute this file
// Explicitly set the working directory. This is crucial for reliability.
cwd: '/var/www/flyer-crawler.projectium.com',
env_production: {
@@ -19,10 +17,8 @@ module.exports = {
},
{
name: 'flyer-crawler-worker', // The name of our worker process in PM2
// Use the same preload mechanism for the worker.
script: './node_modules/.bin/tsx',
args: 'src/services/queueService.server.ts',
node_args: '-r ./preload.ts',
args: 'src/services/queueService.server.ts', // tsx will execute this file
// Explicitly set the working directory.
cwd: '/var/www/flyer-crawler.projectium.com',
env_production: {
@@ -31,11 +27,9 @@ module.exports = {
},
{
name: 'flyer-crawler-analytics-worker', // A dedicated worker for analytics
// Use the same preload mechanism.
script: './node_modules/.bin/tsx',
// Point to the main worker service file. It will start all workers.
args: 'src/services/queueService.server.ts',
node_args: '-r ./preload.ts',
args: 'src/services/queueService.server.ts', // tsx will execute this file
cwd: '/var/www/flyer-crawler.projectium.com',
env_production: {
NODE_ENV: 'production',