Skip to content

Commit

Permalink
BE-686 Fix log for SSL settings in PgService
Browse files Browse the repository at this point in the history
Change-Id: I8ba31d7892abc7fe9150c7506afdc2e2d133f6b3
Signed-off-by: plap <plap@softserveinc.com>
  • Loading branch information
plaptii committed Aug 4, 2019
1 parent f24a57c commit 0aadf19
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions app/persistence/postgreSQL/PgService.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,24 @@ class PgService {
key: fs.readFileSync(`${dbCertsPath}/db-certs/client-key.pem`).toString(),
cert: fs.readFileSync(`${dbCertsPath}/db-certs/client-cert.pem`).toString()
};

/*
* don't log entire config, it contains sensitive information!
* Value this.pgconfig.ssl.key is private key
*/
const { rejectUnauthorized, requestCert } = this.pgconfig.ssl;
const printConfig = { rejectUnauthorized, requestCert };
logger.info('SSL to Postgresql enabled with settings: ', printConfig);
} else {
logger.info('SSL to Postgresql disabled');
}

// don't log password
const connectionString = `postgres://${this.pgconfig.username}:******@${
this.pgconfig.host
}:${this.pgconfig.port}/${this.pgconfig.database}`;

logger.info(
`connecting to Postgresql ${connectionString} ssl details: ${
this.pgconfig.ssl
}`
);
logger.info(`connecting to Postgresql ${connectionString}`);

this.client = new Client(this.pgconfig);

Expand Down

0 comments on commit 0aadf19

Please sign in to comment.