pg-mvc-service 2.0.41 → 2.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Service.js +16 -9
- package/package.json +1 -1
- package/src/Service.ts +16 -9
package/dist/Service.js
CHANGED
|
@@ -44,12 +44,12 @@ class Service {
|
|
|
44
44
|
this.response = new ResponseType_1.ResponseType();
|
|
45
45
|
this.isTest = process.env.NODE_ENV === 'test';
|
|
46
46
|
this.tags = [];
|
|
47
|
-
this.dbUser =
|
|
48
|
-
this.dbHost =
|
|
49
|
-
this.dbName =
|
|
50
|
-
this.dbPassword =
|
|
51
|
-
this.dbPort =
|
|
52
|
-
this.dbIsSslConnect =
|
|
47
|
+
this.dbUser = process.env.DB_USER;
|
|
48
|
+
this.dbHost = process.env.DB_HOST;
|
|
49
|
+
this.dbName = process.env.DB_DATABASE;
|
|
50
|
+
this.dbPassword = process.env.DB_PASSWORD;
|
|
51
|
+
this.dbPort = process.env.DB_PORT;
|
|
52
|
+
this.dbIsSslConnect = process.env.DB_IS_SSL === 'true';
|
|
53
53
|
this.isExecuteRollback = false;
|
|
54
54
|
this.req = request;
|
|
55
55
|
this.res = response;
|
|
@@ -147,9 +147,16 @@ class Service {
|
|
|
147
147
|
});
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
|
-
this.
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
if (this.isTest) {
|
|
151
|
+
this.res.status(500).json({
|
|
152
|
+
message: ex.stack
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
this.res.status(500).json({
|
|
157
|
+
message: 'Internal server error'
|
|
158
|
+
});
|
|
159
|
+
}
|
|
153
160
|
return;
|
|
154
161
|
}
|
|
155
162
|
get Pool() {
|
package/package.json
CHANGED
package/src/Service.ts
CHANGED
|
@@ -45,12 +45,12 @@ export class Service {
|
|
|
45
45
|
await this.middleware();
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
protected dbUser?: string =
|
|
49
|
-
protected dbHost?: string =
|
|
50
|
-
protected dbName?: string =
|
|
51
|
-
protected dbPassword?: string =
|
|
52
|
-
protected dbPort?: string | number =
|
|
53
|
-
protected dbIsSslConnect: boolean =
|
|
48
|
+
protected dbUser?: string = process.env.DB_USER;
|
|
49
|
+
protected dbHost?: string = process.env.DB_HOST;
|
|
50
|
+
protected dbName?: string = process.env.DB_DATABASE;
|
|
51
|
+
protected dbPassword?: string = process.env.DB_PASSWORD;
|
|
52
|
+
protected dbPort?: string | number = process.env.DB_PORT;
|
|
53
|
+
protected dbIsSslConnect: boolean = process.env.DB_IS_SSL === 'true';
|
|
54
54
|
private setPool(): Pool {
|
|
55
55
|
if (this.dbUser === undefined) {
|
|
56
56
|
throw new Error("Database user is not configured");
|
|
@@ -129,9 +129,16 @@ export class Service {
|
|
|
129
129
|
return;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
this.
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
if (this.isTest) {
|
|
133
|
+
this.res.status(500).json({
|
|
134
|
+
message : ex.stack
|
|
135
|
+
});
|
|
136
|
+
} else {
|
|
137
|
+
this.res.status(500).json({
|
|
138
|
+
message : 'Internal server error'
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
135
142
|
return;
|
|
136
143
|
}
|
|
137
144
|
|