Skip to content

Commit

Permalink
config: fix bug in parsing DB_CONN_OPTIONS
Browse files Browse the repository at this point in the history
  • Loading branch information
macno committed Nov 17, 2023
1 parent 9c1abc8 commit aa4c359
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function getMysqlConnectionOptions(prefix = ''): ConnectionOptions {
const DB_HOST = EnvParse.envString(`FW_${prefix}DB_HOST`, 'localhost');
const DB_PORT = EnvParse.envInt(`FW_${prefix}DB_PORT`, 3306);
const DB_NAME = EnvParse.envString(`FW_${prefix}DB_NAME`, DB_USER);
const DB_CONN_OPTIONS = EnvParse.envJSON(`FW_${prefix}DB_NAME`, {});
const DB_CONN_OPTIONS = EnvParse.envJSON(`FW_${prefix}DB_CONN_OPTIONS`, {});

const dbPassword = getDbPassword(DB_PASSWORD_FILE, DB_PASSWORD);
const dbOptions = {
Expand All @@ -54,8 +54,7 @@ export function getMysqlConnectionOptions(prefix = ''): ConnectionOptions {
};
if (Object.keys(DB_CONN_OPTIONS).length > 0) {
// See https://github.com/mysqljs/mysql#connection-options for all possible options
const customOptions = JSON.parse(DB_CONN_OPTIONS);
Object.assign(dbOptions, customOptions);
Object.assign(dbOptions, DB_CONN_OPTIONS);
}
memoizedOptions[prefix] = dbOptions;
}
Expand Down

0 comments on commit aa4c359

Please sign in to comment.