Skip to content

Commit

Permalink
fix: db ssl check unauthorized
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewPattell committed Oct 3, 2023
1 parent 8a7c8d1 commit 922c262
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/helpers/get-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const GetConstants = ({
USERNAME: process.env.DB_USERNAME || 'postgres',
PASSWORD: process.env.DB_PASSWORD || 'example',
DATABASE: process.env.DB_DATABASE || `ms-${process.env.MS_NAME || msNameDefault}`,
IS_SSL_DISABLE: Boolean(Number(process.env.DB_SSL_DISABLE ?? 1)),
IS_REJECT_UNAUTHORIZED: Boolean(Number(process.env.DB_REJECT_UNAUTHORIZED ?? 0)),
IS_FROM_CONFIG_MS: Boolean(Number(process.env.DB_FROM_CONFIG_MS ?? 1)),
},
}
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/get-db-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const getDbConfig = (
const migrationPath = IS_BUILD ? 'lib/' : '';
const packagePath = `node_modules/${extendPackageName || ''}`;

const { URL, HOST, PORT, USERNAME, PASSWORD, DATABASE, IS_SSL_DISABLE } = DB;
const { URL, HOST, PORT, USERNAME, PASSWORD, DATABASE, IS_REJECT_UNAUTHORIZED } = DB;

const entities = [];
const subscribers = [];
Expand Down Expand Up @@ -41,7 +41,7 @@ const getDbConfig = (
username: USERNAME,
password: PASSWORD,
database: DATABASE,
...(IS_SSL_DISABLE ? { ssl: { rejectUnauthorized: false } } : {}),
...(IS_REJECT_UNAUTHORIZED ? { ssl: { rejectUnauthorized: false } } : {}),
}),
entities,
subscribers,
Expand Down

0 comments on commit 922c262

Please sign in to comment.