@feathersjs/configuration 5.0.0-pre.21 → 5.0.0-pre.24
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/CHANGELOG.md +24 -0
- package/lib/index.js +5 -3
- package/lib/index.js.map +1 -1
- package/package.json +8 -8
- package/src/index.ts +22 -21
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [5.0.0-pre.24](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.23...v5.0.0-pre.24) (2022-06-21)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @feathersjs/configuration
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [5.0.0-pre.23](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.22...v5.0.0-pre.23) (2022-06-06)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @feathersjs/configuration
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [5.0.0-pre.22](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.21...v5.0.0-pre.22) (2022-05-24)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @feathersjs/configuration
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
# [5.0.0-pre.21](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.20...v5.0.0-pre.21) (2022-05-23)
|
|
7
31
|
|
|
8
32
|
**Note:** Version bump only for package @feathersjs/configuration
|
package/lib/index.js
CHANGED
|
@@ -12,17 +12,19 @@ module.exports = function init(schema) {
|
|
|
12
12
|
}
|
|
13
13
|
const configuration = { ...config_1.default };
|
|
14
14
|
debug(`Initializing configuration for ${config_1.default.util.getEnv('NODE_ENV')} environment`);
|
|
15
|
-
Object.keys(configuration).forEach(name => {
|
|
15
|
+
Object.keys(configuration).forEach((name) => {
|
|
16
16
|
const value = configuration[name];
|
|
17
17
|
debug(`Setting ${name} configuration value to`, value);
|
|
18
18
|
app.set(name, value);
|
|
19
19
|
});
|
|
20
20
|
if (schema) {
|
|
21
21
|
app.hooks({
|
|
22
|
-
setup: [
|
|
22
|
+
setup: [
|
|
23
|
+
async (_context, next) => {
|
|
23
24
|
await schema.validate(configuration);
|
|
24
25
|
await next();
|
|
25
|
-
}
|
|
26
|
+
}
|
|
27
|
+
]
|
|
26
28
|
});
|
|
27
29
|
}
|
|
28
30
|
return config_1.default;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AACA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AACA,iDAAiD;AAEjD,oDAA2B;AAE3B,MAAM,KAAK,GAAG,IAAA,qBAAW,EAAC,2BAA2B,CAAC,CAAA;AAEtD,iBAAS,SAAS,IAAI,CAAC,MAAoB;IACzC,OAAO,CAAC,GAAiB,EAAE,EAAE;QAC3B,IAAI,CAAC,GAAG,EAAE;YACR,OAAO,gBAAM,CAAA;SACd;QAED,MAAM,aAAa,GAA+B,EAAE,GAAG,gBAAM,EAAE,CAAA;QAE/D,KAAK,CAAC,kCAAkC,gBAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;QAErF,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAC1C,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,CAAA;YACjC,KAAK,CAAC,WAAW,IAAI,yBAAyB,EAAE,KAAK,CAAC,CAAA;YACtD,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACtB,CAAC,CAAC,CAAA;QAEF,IAAI,MAAM,EAAE;YACV,GAAG,CAAC,KAAK,CAAC;gBACR,KAAK,EAAE;oBACL,KAAK,EAAE,QAAgC,EAAE,IAAkB,EAAE,EAAE;wBAC7D,MAAM,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAA;wBACpC,MAAM,IAAI,EAAE,CAAA;oBACd,CAAC;iBACF;aACF,CAAC,CAAA;SACH;QAED,OAAO,gBAAM,CAAA;IACf,CAAC,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feathersjs/configuration",
|
|
3
3
|
"description": "A small configuration module for your Feathers application.",
|
|
4
|
-
"version": "5.0.0-pre.
|
|
4
|
+
"version": "5.0.0-pre.24",
|
|
5
5
|
"homepage": "https://feathersjs.com",
|
|
6
6
|
"main": "lib/",
|
|
7
7
|
"types": "lib/",
|
|
@@ -57,19 +57,19 @@
|
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@feathersjs/commons": "^5.0.0-pre.
|
|
61
|
-
"@feathersjs/feathers": "^5.0.0-pre.
|
|
62
|
-
"@feathersjs/schema": "^5.0.0-pre.
|
|
60
|
+
"@feathersjs/commons": "^5.0.0-pre.24",
|
|
61
|
+
"@feathersjs/feathers": "^5.0.0-pre.24",
|
|
62
|
+
"@feathersjs/schema": "^5.0.0-pre.24",
|
|
63
63
|
"@types/config": "^0.0.41",
|
|
64
64
|
"config": "^3.3.7"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/mocha": "^9.1.1",
|
|
68
|
-
"@types/node": "^17.0.
|
|
68
|
+
"@types/node": "^17.0.40",
|
|
69
69
|
"mocha": "^10.0.0",
|
|
70
70
|
"shx": "^0.3.4",
|
|
71
|
-
"ts-node": "^10.
|
|
72
|
-
"typescript": "^4.
|
|
71
|
+
"ts-node": "^10.8.1",
|
|
72
|
+
"typescript": "^4.7.3"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "72779fa2938f43d7b345b6861ff0035481a07de3"
|
|
75
75
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
import { Application, ApplicationHookContext, NextFunction } from '@feathersjs/feathers'
|
|
2
|
-
import { createDebug } from '@feathersjs/commons'
|
|
1
|
+
import { Application, ApplicationHookContext, NextFunction } from '@feathersjs/feathers'
|
|
2
|
+
import { createDebug } from '@feathersjs/commons'
|
|
3
3
|
import { Schema } from '@feathersjs/schema'
|
|
4
|
-
import config from 'config'
|
|
4
|
+
import config from 'config'
|
|
5
5
|
|
|
6
|
-
const debug = createDebug('@feathersjs/configuration')
|
|
6
|
+
const debug = createDebug('@feathersjs/configuration')
|
|
7
7
|
|
|
8
|
-
export = function init
|
|
8
|
+
export = function init(schema?: Schema<any>) {
|
|
9
9
|
return (app?: Application) => {
|
|
10
10
|
if (!app) {
|
|
11
|
-
return config
|
|
11
|
+
return config
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
const configuration: { [key: string]: unknown } = { ...config }
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
debug(`Initializing configuration for ${config.util.getEnv('NODE_ENV')} environment`)
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
app.set(name, value);
|
|
23
|
-
});
|
|
18
|
+
Object.keys(configuration).forEach((name) => {
|
|
19
|
+
const value = configuration[name]
|
|
20
|
+
debug(`Setting ${name} configuration value to`, value)
|
|
21
|
+
app.set(name, value)
|
|
22
|
+
})
|
|
24
23
|
|
|
25
24
|
if (schema) {
|
|
26
25
|
app.hooks({
|
|
27
|
-
setup: [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
setup: [
|
|
27
|
+
async (_context: ApplicationHookContext, next: NextFunction) => {
|
|
28
|
+
await schema.validate(configuration)
|
|
29
|
+
await next()
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
})
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
return config
|
|
35
|
-
}
|
|
35
|
+
return config
|
|
36
|
+
}
|
|
36
37
|
}
|