diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 652ad23..0bf970e 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -161,5 +161,5 @@ jobs: npm install --omit=dev # Install only production dependencies # Use `startOrReload` with the ecosystem file. This is the standard, idempotent way to deploy. # It will START the process if it's not running, or RELOAD it if it is. - pm2 startOrReload ecosystem.config.js --env production + pm2 startOrReload ecosystem.config.cjs --env production echo "Backend server reloaded successfully." \ No newline at end of file diff --git a/ecosystem.config.js b/ecosystem.config.cjs similarity index 82% rename from ecosystem.config.js rename to ecosystem.config.cjs index 3a0a84b..70e0d0c 100644 --- a/ecosystem.config.js +++ b/ecosystem.config.cjs @@ -1,6 +1,7 @@ -// ecosystem.config.js +// ecosystem.config.cjs // This file is the standard way to configure applications for PM2. // It allows us to define all the settings for our application in one place. +// The .cjs extension is required because the project's package.json has "type": "module". module.exports = { apps: [{ diff --git a/src/services/db/connection.ts b/src/services/db/connection.ts index 0751864..ce1a906 100644 --- a/src/services/db/connection.ts +++ b/src/services/db/connection.ts @@ -14,13 +14,15 @@ const createPool = (): Pool => { logger.info(` Database: ${process.env.DB_DATABASE}`); logger.info('----------------------------------------------------'); - return new Pool({ + const newPool = new Pool({ user: process.env.DB_USER || 'postgres', host: process.env.DB_HOST || 'localhost', database: process.env.DB_NAME || 'flyer-crawler', password: process.env.DB_PASSWORD || 'your_db_password', port: parseInt(process.env.DB_PORT || '5432', 10), }); + logger.info(`Database connection pool created for host: ${process.env.DB_HOST || 'localhost'}`); + return newPool; }; /**