Skip to content

Commit

Permalink
fix: database conn
Browse files Browse the repository at this point in the history
  • Loading branch information
guimroque committed Jun 24, 2024
1 parent c86f662 commit 3cc6514
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/api/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
context: .
working_dir: /api
environment:
- NODE_ENV=${API_ENVIRONMENT}
- API_ENVIRONMENT=${API_ENVIRONMENT}
# DATABASE
- DATABASE_HOST=${DATABASE_HOST}
- DATABASE_PORT=${DATABASE_PORT}
Expand Down
12 changes: 9 additions & 3 deletions packages/api/src/config/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ const {
DATABASE_USERNAME,
DATABASE_NAME,
DATABASE_PORT,
NODE_ENV,
API_ENVIRONMENT,
} = process.env;

const environment: string = NODE_ENV;
const environment: string = API_ENVIRONMENT;
const entitiesDir = path.resolve(__dirname, '..', 'models', '**', '*{.ts,.js}');

console.log('[DATABASE_CONNECTION]: ', {
Expand All @@ -22,7 +22,7 @@ console.log('[DATABASE_CONNECTION]: ', {
DATABASE_USERNAME,
DATABASE_NAME,
DATABASE_PORT,
NODE_ENV,
API_ENVIRONMENT,
})

export const migrationsDir = path.resolve(
Expand Down Expand Up @@ -79,6 +79,9 @@ const production: ConnectionOptions = {
entities: [entitiesDir],
migrations: [migrationsDir, seedersDir],
synchronize: false,
ssl: {
rejectUnauthorized: false,
},
migrationsRun: true,
};

Expand All @@ -92,6 +95,9 @@ const staging: ConnectionOptions = {
entities: [entitiesDir],
migrations: [migrationsDir, seedersDir],
synchronize: false,
ssl: {
rejectUnauthorized: false,
},
migrationsRun: true,
};

Expand Down

0 comments on commit 3cc6514

Please sign in to comment.