File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,17 +15,30 @@ const flash = require('express-flash');
1515const CategoryService = require ( './services/category-service' ) ;
1616const ProductService = require ( './services/product-service' ) ;
1717const UserService = require ( './services/user-service' ) ;
18-
1918const pgp = require ( 'pg-promise' ) ( ) ;
2019
21- let useSSL = false ;
22- let local = process . env . LOCAL || false ;
23- if ( process . env . DATABASE_URL && ! local ) {
24- useSSL = true ;
20+ const DATABASE_URL = process . env . DATABASE_URL || "postgresql://localhost:5432/my_products_list" ;
21+
22+ const config = {
23+ connectionString : DATABASE_URL
24+ }
25+
26+ if ( process . env . NODE_ENV == 'production' ) {
27+ config . ssl = {
28+ rejectUnauthorized : false
29+ }
2530}
26- const connectionString = process . env . DATABASE_URL || 'postgresql://localhost:5432/my_products_list' ;
2731
28- const db = pgp ( connectionString ) ;
32+ const db = pgp ( config ) ;
33+
34+ // let useSSL = false;
35+ // let local = process.env.LOCAL || false;
36+ // if (process.env.DATABASE_URL && !local){
37+ // useSSL = true;
38+ // }
39+ // const connectionString = process.env.DATABASE_URL || 'postgresql://localhost:5432/my_products_list';
40+
41+ // const db = pgp(connectionString);
2942
3043const categoryService = CategoryService ( db ) ;
3144const productService = ProductService ( db ) ;
You can’t perform that action at this time.
0 commit comments