@lenne.tech/nest-server 2.0.2 → 2.0.3
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/core/common/services/config.service.d.ts +1 -1
- package/dist/core/common/services/config.service.js +3 -3
- package/dist/core/common/services/config.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/core/common/services/config.service.ts +7 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lenne.tech/nest-server",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "Modern, fast, powerful Node.js web framework in TypeScript based on Nest with a GraphQL API and a connection to MongoDB (or other databases).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node",
|
|
@@ -14,20 +14,22 @@ export class ConfigService {
|
|
|
14
14
|
* Create config service
|
|
15
15
|
*/
|
|
16
16
|
constructor(config: { [key: string]: any } & Partial<IServerOptions>) {
|
|
17
|
-
this._config = config;
|
|
17
|
+
this._config = config || {};
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* Get config
|
|
21
|
+
* Get config (deep cloned to avoid unwanted side effects)
|
|
22
22
|
*/
|
|
23
23
|
get config() {
|
|
24
24
|
return _.cloneDeep(this._config);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* Get data from config
|
|
28
|
+
* Get data from config (deep cloned to avoid unwanted side effects)
|
|
29
|
+
* @param key Property name of config object, which is to be returned
|
|
30
|
+
* @param defaultValue Default value which is to be returned if property doesn't exist
|
|
29
31
|
*/
|
|
30
|
-
get(key: string) {
|
|
31
|
-
return _.cloneDeep(_.get(this._config, key,
|
|
32
|
+
get(key: string, defaultValue: any = undefined) {
|
|
33
|
+
return _.cloneDeep(_.get(this._config, key, defaultValue));
|
|
32
34
|
}
|
|
33
35
|
}
|