@feathersjs/configuration 5.0.0-pre.2 → 5.0.0-pre.20
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 +162 -0
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/lib/index.d.ts +2 -1
- package/lib/index.js +14 -5
- package/lib/index.js.map +1 -1
- package/package.json +16 -16
- package/src/index.ts +19 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,168 @@
|
|
|
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.20](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.19...v5.0.0-pre.20) (2022-05-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **configuration:** Only validate the initial configuration against the schema ([#2622](https://github.com/feathersjs/feathers/issues/2622)) ([386c5e2](https://github.com/feathersjs/feathers/commit/386c5e2e67bfad4fb4333f2e3e17f7d7e09ac27e))
|
|
12
|
+
* **dependencies:** Lock monorepo package version numbers ([#2623](https://github.com/feathersjs/feathers/issues/2623)) ([5640c10](https://github.com/feathersjs/feathers/commit/5640c1020cc139994e695d658c08bad3494db507))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# [5.0.0-pre.19](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.18...v5.0.0-pre.19) (2022-05-01)
|
|
19
|
+
|
|
20
|
+
**Note:** Version bump only for package @feathersjs/configuration
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
# [5.0.0-pre.18](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.17...v5.0.0-pre.18) (2022-04-11)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
|
|
31
|
+
* **configuration:** Allow app configuration to be validated against a schema ([#2590](https://github.com/feathersjs/feathers/issues/2590)) ([a268f86](https://github.com/feathersjs/feathers/commit/a268f86da92a8ada14ed11ab456aac0a4bba5bb0))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# [5.0.0-pre.17](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.16...v5.0.0-pre.17) (2022-02-15)
|
|
38
|
+
|
|
39
|
+
**Note:** Version bump only for package @feathersjs/configuration
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# [5.0.0-pre.16](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.15...v5.0.0-pre.16) (2022-01-12)
|
|
46
|
+
|
|
47
|
+
**Note:** Version bump only for package @feathersjs/configuration
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# [5.0.0-pre.15](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.14...v5.0.0-pre.15) (2021-11-27)
|
|
54
|
+
|
|
55
|
+
**Note:** Version bump only for package @feathersjs/configuration
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
# [5.0.0-pre.14](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.13...v5.0.0-pre.14) (2021-10-13)
|
|
62
|
+
|
|
63
|
+
**Note:** Version bump only for package @feathersjs/configuration
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
# [5.0.0-pre.13](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.12...v5.0.0-pre.13) (2021-10-13)
|
|
70
|
+
|
|
71
|
+
**Note:** Version bump only for package @feathersjs/configuration
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
# [5.0.0-pre.12](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.11...v5.0.0-pre.12) (2021-10-12)
|
|
78
|
+
|
|
79
|
+
**Note:** Version bump only for package @feathersjs/configuration
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
# [5.0.0-pre.11](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.10...v5.0.0-pre.11) (2021-10-06)
|
|
86
|
+
|
|
87
|
+
**Note:** Version bump only for package @feathersjs/configuration
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
# [5.0.0-pre.10](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.9...v5.0.0-pre.10) (2021-09-19)
|
|
94
|
+
|
|
95
|
+
**Note:** Version bump only for package @feathersjs/configuration
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
# [5.0.0-pre.9](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.8...v5.0.0-pre.9) (2021-08-09)
|
|
102
|
+
|
|
103
|
+
**Note:** Version bump only for package @feathersjs/configuration
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
# [5.0.0-pre.8](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.7...v5.0.0-pre.8) (2021-08-09)
|
|
110
|
+
|
|
111
|
+
**Note:** Version bump only for package @feathersjs/configuration
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
# [5.0.0-pre.7](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.6...v5.0.0-pre.7) (2021-08-09)
|
|
118
|
+
|
|
119
|
+
**Note:** Version bump only for package @feathersjs/configuration
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
# [5.0.0-pre.6](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.5...v5.0.0-pre.6) (2021-08-08)
|
|
126
|
+
|
|
127
|
+
**Note:** Version bump only for package @feathersjs/configuration
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
# [5.0.0-pre.5](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.4...v5.0.0-pre.5) (2021-06-23)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
### Bug Fixes
|
|
137
|
+
|
|
138
|
+
* **koa:** Use extended query parser for compatibility ([#2397](https://github.com/feathersjs/feathers/issues/2397)) ([b2944ba](https://github.com/feathersjs/feathers/commit/b2944bac3ec6d5ecc80dc518cd4e58093692db74))
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
# [5.0.0-pre.4](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.3...v5.0.0-pre.4) (2021-05-13)
|
|
145
|
+
|
|
146
|
+
**Note:** Version bump only for package @feathersjs/configuration
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
# [5.0.0-pre.3](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.2...v5.0.0-pre.3) (2021-04-21)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
### Bug Fixes
|
|
156
|
+
|
|
157
|
+
* **typescript:** Improve TypeScript backwards compatibility ([#2310](https://github.com/feathersjs/feathers/issues/2310)) ([f33be73](https://github.com/feathersjs/feathers/commit/f33be73fc46a533efb15df9aab0658e3240d3897))
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
### Features
|
|
161
|
+
|
|
162
|
+
* **dependencies:** Remove direct debug dependency ([#2296](https://github.com/feathersjs/feathers/issues/2296)) ([501d416](https://github.com/feathersjs/feathers/commit/501d4164d30c6a126906dc640cdfdc82207ba34a))
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
6
168
|
# [5.0.0-pre.2](https://github.com/feathersjs/feathers/compare/v5.0.0-beta.1...v5.0.0-pre.2) (2021-04-06)
|
|
7
169
|
|
|
8
170
|
**Note:** Version bump only for package @feathersjs/configuration
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @feathersjs/configuration
|
|
2
2
|
|
|
3
3
|
[](https://github.com/feathersjs/feathers/actions?query=workflow%3ACI)
|
|
4
|
-
[](https://david-dm.org/feathersjs/feathers?path=packages/configuration)
|
|
5
4
|
[](https://www.npmjs.com/package/@feathersjs/configuration)
|
|
5
|
+
[](https://discord.gg/qa8kez8QBx)
|
|
6
6
|
|
|
7
7
|
> A small configuration module for your Feathers application.
|
|
8
8
|
|
|
@@ -18,6 +18,6 @@ Refer to the [Feathers configuration API documentation](https://docs.feathersjs.
|
|
|
18
18
|
|
|
19
19
|
## License
|
|
20
20
|
|
|
21
|
-
Copyright (c)
|
|
21
|
+
Copyright (c) 2022 [Feathers contributors](https://github.com/feathersjs/feathers/graphs/contributors)
|
|
22
22
|
|
|
23
23
|
Licensed under the [MIT license](LICENSE).
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Application } from '@feathersjs/feathers';
|
|
2
|
+
import { Schema } from '@feathersjs/schema';
|
|
2
3
|
import config from 'config';
|
|
3
|
-
declare const _default: () => (app?: Application) => config.IConfig;
|
|
4
|
+
declare const _default: (schema?: Schema<any>) => (app?: Application) => config.IConfig;
|
|
4
5
|
export = _default;
|
package/lib/index.js
CHANGED
|
@@ -2,20 +2,29 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
-
const
|
|
5
|
+
const commons_1 = require("@feathersjs/commons");
|
|
6
6
|
const config_1 = __importDefault(require("config"));
|
|
7
|
-
const debug =
|
|
8
|
-
module.exports = function init() {
|
|
7
|
+
const debug = (0, commons_1.createDebug)('@feathersjs/configuration');
|
|
8
|
+
module.exports = function init(schema) {
|
|
9
9
|
return (app) => {
|
|
10
10
|
if (!app) {
|
|
11
11
|
return config_1.default;
|
|
12
12
|
}
|
|
13
|
+
const configuration = { ...config_1.default };
|
|
13
14
|
debug(`Initializing configuration for ${config_1.default.util.getEnv('NODE_ENV')} environment`);
|
|
14
|
-
Object.keys(
|
|
15
|
-
const value =
|
|
15
|
+
Object.keys(configuration).forEach(name => {
|
|
16
|
+
const value = configuration[name];
|
|
16
17
|
debug(`Setting ${name} configuration value to`, value);
|
|
17
18
|
app.set(name, value);
|
|
18
19
|
});
|
|
20
|
+
if (schema) {
|
|
21
|
+
app.hooks({
|
|
22
|
+
setup: [async (_context, next) => {
|
|
23
|
+
await schema.validate(configuration);
|
|
24
|
+
await next();
|
|
25
|
+
}]
|
|
26
|
+
});
|
|
27
|
+
}
|
|
19
28
|
return config_1.default;
|
|
20
29
|
};
|
|
21
30
|
};
|
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,iDAAkD;AAElD,oDAA4B;AAE5B,MAAM,KAAK,GAAG,IAAA,qBAAW,EAAC,2BAA2B,CAAC,CAAC;AAEvD,iBAAS,SAAS,IAAI,CAAE,MAAoB;IAC1C,OAAO,CAAC,GAAiB,EAAE,EAAE;QAC3B,IAAI,CAAC,GAAG,EAAE;YACR,OAAO,gBAAM,CAAC;SACf;QAGD,MAAM,aAAa,GAA+B,EAAE,GAAG,gBAAM,EAAE,CAAC;QAEhE,KAAK,CAAC,kCAAkC,gBAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;QAEtF,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACxC,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;YAClC,KAAK,CAAC,WAAW,IAAI,yBAAyB,EAAE,KAAK,CAAC,CAAC;YACvD,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;QAEH,IAAI,MAAM,EAAE;YACV,GAAG,CAAC,KAAK,CAAC;gBACR,KAAK,EAAE,CAAC,KAAK,EAAE,QAAgC,EAAE,IAAkB,EAAE,EAAE;wBACrE,MAAM,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;wBACrC,MAAM,IAAI,EAAE,CAAC;oBACf,CAAC,CAAC;aACH,CAAC,CAAC;SACJ;QAED,OAAO,gBAAM,CAAC;IAChB,CAAC,CAAC;AACJ,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.20",
|
|
5
5
|
"homepage": "https://feathersjs.com",
|
|
6
6
|
"main": "lib/",
|
|
7
7
|
"types": "lib/",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
},
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
|
-
"url": "git://github.com/feathersjs/feathers.git"
|
|
19
|
+
"url": "git://github.com/feathersjs/feathers.git",
|
|
20
|
+
"directory": "packages/configuration"
|
|
20
21
|
},
|
|
21
22
|
"author": {
|
|
22
23
|
"name": "Feathers contributors",
|
|
@@ -42,8 +43,7 @@
|
|
|
42
43
|
"scripts": {
|
|
43
44
|
"prepublish": "npm run compile",
|
|
44
45
|
"compile": "shx rm -rf lib/ && tsc",
|
|
45
|
-
"test": "
|
|
46
|
-
"mocha": "NODE_CONFIG_DIR=./test/config mocha --config ../../.mocharc.json --recursive test/**.test.ts test/**/*.test.ts"
|
|
46
|
+
"test": "NODE_CONFIG_DIR=./test/config mocha --config ../../.mocharc.json --recursive test/**.test.ts test/**/*.test.ts"
|
|
47
47
|
},
|
|
48
48
|
"semistandard": {
|
|
49
49
|
"env": [
|
|
@@ -57,19 +57,19 @@
|
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@feathersjs/
|
|
61
|
-
"
|
|
62
|
-
"
|
|
60
|
+
"@feathersjs/commons": "^5.0.0-pre.20",
|
|
61
|
+
"@feathersjs/feathers": "^5.0.0-pre.20",
|
|
62
|
+
"@feathersjs/schema": "^5.0.0-pre.20",
|
|
63
|
+
"@types/config": "^0.0.41",
|
|
64
|
+
"config": "^3.3.7"
|
|
63
65
|
},
|
|
64
66
|
"devDependencies": {
|
|
65
|
-
"@types/
|
|
66
|
-
"@types/
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"ts-node": "^9.1.1",
|
|
72
|
-
"typescript": "^4.2.3"
|
|
67
|
+
"@types/mocha": "^9.1.1",
|
|
68
|
+
"@types/node": "^17.0.31",
|
|
69
|
+
"mocha": "^10.0.0",
|
|
70
|
+
"shx": "^0.3.4",
|
|
71
|
+
"ts-node": "^10.7.0",
|
|
72
|
+
"typescript": "^4.6.4"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "54de749a0b392c7da726c668002b50cafaca530c"
|
|
75
75
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,23 +1,36 @@
|
|
|
1
|
-
import { Application } from '@feathersjs/feathers';
|
|
2
|
-
import
|
|
1
|
+
import { Application, ApplicationHookContext, NextFunction } from '@feathersjs/feathers';
|
|
2
|
+
import { createDebug } from '@feathersjs/commons';
|
|
3
|
+
import { Schema } from '@feathersjs/schema'
|
|
3
4
|
import config from 'config';
|
|
4
5
|
|
|
5
|
-
const debug =
|
|
6
|
+
const debug = createDebug('@feathersjs/configuration');
|
|
6
7
|
|
|
7
|
-
export = function init () {
|
|
8
|
+
export = function init (schema?: Schema<any>) {
|
|
8
9
|
return (app?: Application) => {
|
|
9
10
|
if (!app) {
|
|
10
11
|
return config;
|
|
11
12
|
}
|
|
12
13
|
|
|
14
|
+
|
|
15
|
+
const configuration: { [key: string]: unknown } = { ...config };
|
|
16
|
+
|
|
13
17
|
debug(`Initializing configuration for ${config.util.getEnv('NODE_ENV')} environment`);
|
|
14
18
|
|
|
15
|
-
Object.keys(
|
|
16
|
-
const value =
|
|
19
|
+
Object.keys(configuration).forEach(name => {
|
|
20
|
+
const value = configuration[name];
|
|
17
21
|
debug(`Setting ${name} configuration value to`, value);
|
|
18
22
|
app.set(name, value);
|
|
19
23
|
});
|
|
20
24
|
|
|
25
|
+
if (schema) {
|
|
26
|
+
app.hooks({
|
|
27
|
+
setup: [async (_context: ApplicationHookContext, next: NextFunction) => {
|
|
28
|
+
await schema.validate(configuration);
|
|
29
|
+
await next();
|
|
30
|
+
}]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
21
34
|
return config;
|
|
22
35
|
};
|
|
23
36
|
}
|