@breautek/storm 6.1.0-beta.1 → 6.1.0-beta.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/CHANGELOG.md +13 -0
- package/docs/assets/search.js +1 -1
- package/docs/classes/Application.html +16 -16
- package/docs/classes/BackendAuthenticationMiddleware.html +3 -3
- package/docs/classes/CORSMiddleware.html +3 -3
- package/docs/classes/ConfigLoader.html +3 -3
- package/docs/classes/Database.html +2 -2
- package/docs/classes/DatabaseCastObject.html +2 -2
- package/docs/classes/DatabaseConnection.html +19 -19
- package/docs/classes/DatabaseQueryError.html +5 -5
- package/docs/classes/DeadLockError.html +5 -5
- package/docs/classes/DiskSpaceError.html +5 -5
- package/docs/classes/DropTemporaryTableQuery.html +6 -6
- package/docs/classes/DuplicateEntryError.html +5 -5
- package/docs/classes/EntityNotFoundError.html +5 -5
- package/docs/classes/ExpiredTokenError.html +5 -5
- package/docs/classes/Handler.html +2 -2
- package/docs/classes/InternalError.html +5 -5
- package/docs/classes/InvalidCredentialsError.html +5 -5
- package/docs/classes/InvalidValueError.html +5 -5
- package/docs/classes/LineString.html +2 -2
- package/docs/classes/LockWaitTimeoutError.html +5 -5
- package/docs/classes/ManagedDatabaseConnection.html +2 -2
- package/docs/classes/Middleware.html +2 -2
- package/docs/classes/MissingConfigError.html +5 -5
- package/docs/classes/MissingParameterError.html +5 -5
- package/docs/classes/MySQLConnection.html +19 -19
- package/docs/classes/MySQLDatabase.html +2 -2
- package/docs/classes/NotImplementedError.html +5 -5
- package/docs/classes/Point.html +2 -2
- package/docs/classes/Polygon.html +2 -2
- package/docs/classes/Query.html +6 -6
- package/docs/classes/RawError.html +5 -5
- package/docs/classes/RawQuery.html +6 -6
- package/docs/classes/Request.html +2 -2
- package/docs/classes/Response.html +2 -2
- package/docs/classes/ResponseData.html +2 -2
- package/docs/classes/ServiceProvider.html +2 -2
- package/docs/classes/ServiceResponse.html +2 -2
- package/docs/classes/SetSessionVariableQuery.html +6 -6
- package/docs/classes/StormError.html +5 -5
- package/docs/classes/TemporaryTableQuery.html +6 -6
- package/docs/classes/Token.html +2 -2
- package/docs/classes/TokenManager.html +2 -2
- package/docs/classes/Transaction.html +2 -2
- package/docs/classes/UnauthorizedAccessError.html +5 -5
- package/docs/enums/ErrorCode.html +2 -2
- package/docs/enums/ExitCode.html +2 -2
- package/docs/enums/HTTPMethod.html +2 -2
- package/docs/enums/IsolationLevel.html +2 -2
- package/docs/enums/JWTError.html +2 -2
- package/docs/enums/StatusCode.html +2 -2
- package/docs/functions/getInstance.html +1 -1
- package/docs/interfaces/IAdditionalErrorDetails.html +1 -1
- package/docs/interfaces/ICloudwatchConfig.html +2 -2
- package/docs/interfaces/ICloudwatchCredentials.html +2 -2
- package/docs/interfaces/ICloudwatchStreamConfig.html +2 -2
- package/docs/interfaces/IConfig.html +3 -2
- package/docs/interfaces/IDatabaseConfig.html +2 -2
- package/docs/interfaces/IDatabaseConnection.html +2 -2
- package/docs/interfaces/IErrorResponse.html +2 -2
- package/docs/interfaces/IFormData.html +2 -2
- package/docs/interfaces/IHandler.html +2 -2
- package/docs/interfaces/IInsertQueryResult.html +2 -2
- package/docs/interfaces/IJWTVerifyOptions.html +2 -2
- package/docs/interfaces/IParameterMap.html +1 -1
- package/docs/interfaces/IQueryable.html +2 -2
- package/docs/interfaces/IRequestResponse.html +2 -2
- package/docs/interfaces/IServiceHeaders.html +1 -1
- package/docs/interfaces/ISetSessionVariableQueryInput.html +2 -2
- package/docs/interfaces/ITemporaryTableQueryInput.html +2 -2
- package/docs/interfaces/IUpdateQueryResult.html +2 -2
- package/docs/types/IDeleteQueryResult.html +1 -1
- package/docs/types/IHandlerError.html +1 -1
- package/docs/types/IHandlerResponse.html +1 -1
- package/docs/types/TCoordinate.html +1 -1
- package/lib/ConfigLoader.js +18 -28
- package/lib/ConfigLoader.js.map +1 -1
- package/lib/IConfig.d.ts +1 -0
- package/package.json +2 -2
- package/src/ConfigLoader.ts +28 -43
- package/src/IConfig.ts +2 -1
package/src/ConfigLoader.ts
CHANGED
|
@@ -65,8 +65,17 @@ export class ConfigLoader<TConfig extends IConfig = IConfig> {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
logger.trace(TAG, 'Reading command line arguments...');
|
|
68
|
+
|
|
69
|
+
// This pulls IConfig rules into the base config as expected
|
|
68
70
|
config = MergeChange.merge(config, this.$getCmdLineArgs());
|
|
69
71
|
|
|
72
|
+
if (!config.customConfig) {
|
|
73
|
+
config.customConfig = {};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// This will pull all custom configurations into customConfig
|
|
77
|
+
config.customConfig = MergeChange.merge(config.customConfig, this.$app.getCmdLineArgs());
|
|
78
|
+
|
|
70
79
|
if (config.log.level === null) {
|
|
71
80
|
config.log.level = defaults.log.level;
|
|
72
81
|
}
|
|
@@ -87,46 +96,6 @@ export class ConfigLoader<TConfig extends IConfig = IConfig> {
|
|
|
87
96
|
public static async load(path: string): Promise<IConfig> {
|
|
88
97
|
let loader: ConfigLoader = new ConfigLoader<IConfig>(getInstance());
|
|
89
98
|
return await loader.load(Path.resolve(path, 'bt-config.json'), Path.resolve('bt-local-config.json'));
|
|
90
|
-
|
|
91
|
-
// let logger: Logger = ConfigLoader.$getLogger();
|
|
92
|
-
|
|
93
|
-
// logger.trace(TAG, 'Configuration loaded.');
|
|
94
|
-
|
|
95
|
-
// let config: IConfig = {};
|
|
96
|
-
|
|
97
|
-
// let cPath: string = Path.resolve(path, 'bt-config.json');
|
|
98
|
-
// let lPath: string = Path.resolve(path, 'bt-local-config.json');
|
|
99
|
-
|
|
100
|
-
// let c: IConfig;
|
|
101
|
-
// let l: IConfig;
|
|
102
|
-
// let defaults: IConfig = this.$getDefaults();
|
|
103
|
-
|
|
104
|
-
// logger.trace(TAG, `Main Config Path:\t ${cPath}`);
|
|
105
|
-
// logger.trace(TAG, `Local Config Path:\t ${lPath}`);
|
|
106
|
-
|
|
107
|
-
// c = this.$getMainConfig(cPath);
|
|
108
|
-
// l = this.$getLocalConfig(lPath);
|
|
109
|
-
|
|
110
|
-
// if (l) {
|
|
111
|
-
// config = MergeChange.merge(defaults, c, l);
|
|
112
|
-
// }
|
|
113
|
-
// else {
|
|
114
|
-
// config = MergeChange.merge(defaults, c);
|
|
115
|
-
// }
|
|
116
|
-
|
|
117
|
-
// logger.trace(TAG, 'Reading command line arguments...');
|
|
118
|
-
// config = MergeChange.merge(config, ConfigLoader.$getCmdLineArgs());
|
|
119
|
-
|
|
120
|
-
// if (config.log.level === null) {
|
|
121
|
-
// config.log.level = defaults.log.level;
|
|
122
|
-
// }
|
|
123
|
-
|
|
124
|
-
// logger.trace(TAG, 'Configurations merged.');
|
|
125
|
-
// logger.trace(TAG, config);
|
|
126
|
-
|
|
127
|
-
// await ConfigLoader.$validateSchema(config);
|
|
128
|
-
|
|
129
|
-
// return config;
|
|
130
99
|
}
|
|
131
100
|
|
|
132
101
|
private $getLocalConfig(path: string): IConfig {
|
|
@@ -162,7 +131,7 @@ export class ConfigLoader<TConfig extends IConfig = IConfig> {
|
|
|
162
131
|
return require(Path.resolve(__dirname, '../bt-config-defaults.json'));
|
|
163
132
|
}
|
|
164
133
|
|
|
165
|
-
private async $validateSchema(config:
|
|
134
|
+
private async $validateSchema(config: Partial<TConfig>): Promise<void> {
|
|
166
135
|
let ajv: Ajv = new Ajv({
|
|
167
136
|
allErrors: true
|
|
168
137
|
});
|
|
@@ -271,7 +240,23 @@ export class ConfigLoader<TConfig extends IConfig = IConfig> {
|
|
|
271
240
|
}
|
|
272
241
|
}
|
|
273
242
|
|
|
274
|
-
private $getCmdLineArgs():
|
|
275
|
-
|
|
243
|
+
private $getCmdLineArgs(): Partial<IConfig> {
|
|
244
|
+
let cliArgs: IStormCLIArgs = this.$app.getCmdLineArgs();
|
|
245
|
+
|
|
246
|
+
let out: Partial<IConfig> = {}
|
|
247
|
+
|
|
248
|
+
if (cliArgs.bind !== undefined) {
|
|
249
|
+
out.bind = cliArgs.bind;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if (cliArgs.port !== undefined) {
|
|
253
|
+
out.port = cliArgs.port;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (cliArgs.authentication_header !== undefined) {
|
|
257
|
+
out.authentication_header = cliArgs.authentication_header;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
return out;
|
|
276
261
|
}
|
|
277
262
|
}
|