diff --git a/README.md b/README.md index 74870db..4db2f86 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ application. - 1. Clone this repository `git clone https://github.com/sergeyyarkov/node-docker-example.git .` - 2. Configure enviroment variables in `docker-compose.yml` for `postgres` and `nodejs` serivces if you need to -- 3. Build and run application with `docker compose up --build` +- 3. Build and run application with `docker-compose up --build` ## Requirements diff --git a/db.js b/db.js index 5334ffb..1a09f18 100644 --- a/db.js +++ b/db.js @@ -6,12 +6,14 @@ class Database { constructor() { this.client = new pg.Client({ connectionString: - process.env.NODE_ENV === 'production' + process.env.NODE_ENV === 'production' && process.env.DATABASE_URL ? process.env.DATABASE_URL : connectionString, - ssl: { - rejectUnauthorized: false, - }, + ssl: process.env.DATABASE_URL + ? { + rejectUnauthorized: false, + } + : false, }); } }