@twin.org/node-core 0.9.2-next.15 → 0.9.2-next.16
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/es/builders/engineEnvBuilder.js +118 -76
- package/dist/es/builders/engineEnvBuilder.js.map +1 -1
- package/dist/es/builders/engineServerEnvBuilder.js +6 -5
- package/dist/es/builders/engineServerEnvBuilder.js.map +1 -1
- package/dist/es/builders/helper/envHelpers.js +57 -72
- package/dist/es/builders/helper/envHelpers.js.map +1 -1
- package/dist/es/models/IEngineEnvironmentVariables.js.map +1 -1
- package/dist/es/models/IEngineServerEnvironmentVariables.js.map +1 -1
- package/dist/es/models/engineEnvironmentVariableKeys.js +2 -0
- package/dist/es/models/engineEnvironmentVariableKeys.js.map +1 -1
- package/dist/es/models/engineServerEnvironmentVariableKeys.js +1 -0
- package/dist/es/models/engineServerEnvironmentVariableKeys.js.map +1 -1
- package/dist/es/node.js +1 -1
- package/dist/es/node.js.map +1 -1
- package/dist/types/builders/engineEnvBuilder.d.ts +4 -4
- package/dist/types/builders/helper/envHelpers.d.ts +79 -20
- package/dist/types/models/IEngineEnvironmentVariables.d.ts +12 -2
- package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +4 -0
- package/docs/changelog.md +8 -0
- package/docs/reference/functions/{isTelemetryRequired.md → isTelemetryEnabled.md} +3 -3
- package/docs/reference/functions/{isTracingRequired.md → isTracingEnabled.md} +3 -3
- package/docs/reference/index.md +2 -2
- package/docs/reference/interfaces/IEngineEnvironmentVariables.md +30 -2
- package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +8 -0
- package/locales/en.json +1 -0
- package/package.json +1 -1
|
@@ -4,8 +4,8 @@ import { addDefaultRestPaths, addDefaultSocketPaths } from "@twin.org/engine-ser
|
|
|
4
4
|
import { AuthenticationAdminComponentType, AuthenticationAuditComponentType, AuthenticationComponentType, AuthenticationRateComponentType, InformationComponentType, RestRouteProcessorType, SocketRouteProcessorType } from "@twin.org/engine-server-types";
|
|
5
5
|
import { TraceparentHelper } from "@twin.org/tracing-models";
|
|
6
6
|
import { CONTEXT_ID_HANDLER_FEATURE_DID, CONTEXT_ID_HANDLER_FEATURE_TENANT } from "../defaults.js";
|
|
7
|
-
import {
|
|
8
|
-
import { commaSeparatedListToArray } from "./helper/envHelpers.js";
|
|
7
|
+
import { isTelemetryEnabled, isTracingEnabled } from "./engineEnvBuilder.js";
|
|
8
|
+
import { commaSeparatedListToArray, envKeyIntegerPairs } from "./helper/envHelpers.js";
|
|
9
9
|
/**
|
|
10
10
|
* Handles the configuration of the server.
|
|
11
11
|
* @param envVars The environment variables for the engine server.
|
|
@@ -24,6 +24,7 @@ export async function buildEngineServerConfiguration(envVars, availableContextId
|
|
|
24
24
|
allowedHeaders: commaSeparatedListToArray(envVars.httpAllowedHeaders, undefined),
|
|
25
25
|
exposedHeaders: commaSeparatedListToArray(envVars.httpExposedHeaders, undefined),
|
|
26
26
|
corsOrigins: commaSeparatedListToArray(envVars.corsOrigins, undefined),
|
|
27
|
+
bodyLimits: envKeyIntegerPairs(envVars, "httpBodyLimits"),
|
|
27
28
|
publicOrigin: Coerce.string(envVars.publicOrigin)
|
|
28
29
|
};
|
|
29
30
|
const tenantEnabled = Coerce.boolean(envVars.tenantEnabled) ?? false;
|
|
@@ -34,7 +35,7 @@ export async function buildEngineServerConfiguration(envVars, availableContextId
|
|
|
34
35
|
webServerOptions.allowedHeaders.push(apiKeyHeader);
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
|
-
if (
|
|
38
|
+
if (isTracingEnabled(envVars)) {
|
|
38
39
|
webServerOptions.allowedHeaders ??= [];
|
|
39
40
|
if (!webServerOptions.allowedHeaders.includes(TraceparentHelper.HEADER_NAME)) {
|
|
40
41
|
webServerOptions.allowedHeaders.push(TraceparentHelper.HEADER_NAME);
|
|
@@ -228,7 +229,7 @@ export async function buildEngineServerConfiguration(envVars, availableContextId
|
|
|
228
229
|
});
|
|
229
230
|
}
|
|
230
231
|
}
|
|
231
|
-
if (
|
|
232
|
+
if (isTelemetryEnabled(envVars)) {
|
|
232
233
|
serverConfig.types.restRouteProcessor.push({
|
|
233
234
|
type: RestRouteProcessorType.Metrics,
|
|
234
235
|
options: {
|
|
@@ -238,7 +239,7 @@ export async function buildEngineServerConfiguration(envVars, availableContextId
|
|
|
238
239
|
}
|
|
239
240
|
});
|
|
240
241
|
}
|
|
241
|
-
if (
|
|
242
|
+
if (isTracingEnabled(envVars)) {
|
|
242
243
|
serverConfig.types.restRouteProcessor.push({
|
|
243
244
|
type: RestRouteProcessorType.Tracing,
|
|
244
245
|
options: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engineServerEnvBuilder.js","sourceRoot":"","sources":["../../../src/builders/engineServerEnvBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EACN,gCAAgC,EAChC,gCAAgC,EAChC,2BAA2B,EAC3B,+BAA+B,EAE/B,wBAAwB,EAExB,sBAAsB,EACtB,wBAAwB,EACxB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,8BAA8B,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAEnE;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,8BAA8B,CACnD,OAAmE,EACnE,sBAA4E,EAC5E,gBAAmC,EACnC,UAAuB,EACvB,eAAwB,EACxB,WAAoB;IAEpB,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Aa,IAAI,YAAY,CAAC,KAAK,EAAE,CAAC;QAChD,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QAEhD,IAAI,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,KAAK,MAAM,UAAU,IAAI,KAAK,EAAE,CAAC;gBAChC,IAAI,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;oBACzC,MAAM,UAAU,GAAG,WAAW,YAAY,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC;oBAChG,MAAM,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;oBAC7C,IAAI,EAAE,CAAC,WAAW,CAAC,gBAAgB,CAAC,EAAE,CAAC;wBACtC,UAAU,CAAC,QAAQ,GAAG,gBAAgB,CAAC;oBACxC,CAAC;oBACD,MAAM;gBACP,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,YAAY,CAAC;AACrB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAAC,OAA8B;IACzE,OAAO,CACN,OAAO,CAAC,sBAAsB,KAAK,gCAAgC,CAAC,aAAa;QACjF,OAAO,CAAC,iBAAiB,KAAK,2BAA2B,CAAC,aAAa,CACvE,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IServerInfo, IWebServerOptions } from \"@twin.org/api-models\";\nimport { ContextIdKeys } from \"@twin.org/context\";\nimport { Coerce, Is, StringHelper } from \"@twin.org/core\";\nimport type { IEngineCoreConfig } from \"@twin.org/engine-models\";\nimport { addDefaultRestPaths, addDefaultSocketPaths } from \"@twin.org/engine-server\";\nimport {\n\tAuthenticationAdminComponentType,\n\tAuthenticationAuditComponentType,\n\tAuthenticationComponentType,\n\tAuthenticationRateComponentType,\n\ttype IEngineServerConfig,\n\tInformationComponentType,\n\ttype MimeTypeProcessorType,\n\tRestRouteProcessorType,\n\tSocketRouteProcessorType\n} from \"@twin.org/engine-server-types\";\nimport { TraceparentHelper } from \"@twin.org/tracing-models\";\nimport { CONTEXT_ID_HANDLER_FEATURE_DID, CONTEXT_ID_HANDLER_FEATURE_TENANT } from \"../defaults.js\";\nimport { isTelemetryRequired, isTracingRequired } from \"./engineEnvBuilder.js\";\nimport type { IEnvironmentVariables } from \"../models/IEnvironmentVariables.js\";\nimport { commaSeparatedListToArray } from \"./helper/envHelpers.js\";\n\n/**\n * Handles the configuration of the server.\n * @param envVars The environment variables for the engine server.\n * @param availableContextIdKeys The context ID keys.\n * @param coreEngineConfig The core engine config.\n * @param serverInfo The server information.\n * @param openApiSpecPath The path to the open api spec.\n * @param favIconPath The path to the favicon.\n * @returns The config for the core and the server.\n */\nexport async function buildEngineServerConfiguration(\n\tenvVars: IEnvironmentVariables & { [id: string]: string | unknown },\n\tavailableContextIdKeys: { key: string; requiredHandlerFeatures: string[] }[],\n\tcoreEngineConfig: IEngineCoreConfig,\n\tserverInfo: IServerInfo,\n\topenApiSpecPath?: string,\n\tfavIconPath?: string\n): Promise<IEngineServerConfig> {\n\tconst webServerOptions: IWebServerOptions = {\n\t\tport: Coerce.number(envVars.port),\n\t\thost: Coerce.string(envVars.host),\n\t\tmethods: commaSeparatedListToArray(envVars.httpMethods, undefined),\n\t\tallowedHeaders: commaSeparatedListToArray(envVars.httpAllowedHeaders, undefined),\n\t\texposedHeaders: commaSeparatedListToArray(envVars.httpExposedHeaders, undefined),\n\t\tcorsOrigins: commaSeparatedListToArray(envVars.corsOrigins, undefined),\n\t\tpublicOrigin: Coerce.string(envVars.publicOrigin)\n\t};\n\n\tconst tenantEnabled = Coerce.boolean(envVars.tenantEnabled) ?? false;\n\tconst apiKeyHeader = envVars.authApiKeyHeader ?? \"x-api-key\";\n\tif (tenantEnabled) {\n\t\twebServerOptions.allowedHeaders ??= [];\n\t\tif (!webServerOptions.allowedHeaders.includes(apiKeyHeader)) {\n\t\t\twebServerOptions.allowedHeaders.push(apiKeyHeader);\n\t\t}\n\t}\n\n\tif (isTracingRequired(envVars)) {\n\t\twebServerOptions.allowedHeaders ??= [];\n\t\tif (!webServerOptions.allowedHeaders.includes(TraceparentHelper.HEADER_NAME)) {\n\t\t\twebServerOptions.allowedHeaders.push(TraceparentHelper.HEADER_NAME);\n\t\t}\n\t}\n\n\tconst serverConfig: IEngineServerConfig = {\n\t\t...coreEngineConfig,\n\t\tweb: webServerOptions,\n\t\ttypes: {\n\t\t\t...coreEngineConfig.types,\n\t\t\tinformationComponent: [\n\t\t\t\t{\n\t\t\t\t\ttype: InformationComponentType.Service,\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\tserverInfo,\n\t\t\t\t\t\t\topenApiSpecPath,\n\t\t\t\t\t\t\tfavIconPath\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t}\n\t};\n\n\tif (Is.stringValue(envVars.mimeTypeProcessors)) {\n\t\tconst mimeTypeProcessors = commaSeparatedListToArray(envVars.mimeTypeProcessors);\n\n\t\tif (Is.arrayValue(mimeTypeProcessors)) {\n\t\t\tserverConfig.types.mimeTypeProcessor ??= [];\n\t\t\tfor (const mimeTypeProcessor of mimeTypeProcessors) {\n\t\t\t\tserverConfig.types.mimeTypeProcessor.push({\n\t\t\t\t\ttype: mimeTypeProcessor as MimeTypeProcessorType\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tserverConfig.types.restRouteProcessor ??= [];\n\tserverConfig.types.socketRouteProcessor ??= [];\n\n\tavailableContextIdKeys.push({\n\t\tkey: ContextIdKeys.Node,\n\t\trequiredHandlerFeatures: [CONTEXT_ID_HANDLER_FEATURE_DID]\n\t});\n\n\tserverConfig.types.restRouteProcessor.push({\n\t\ttype: RestRouteProcessorType.ContextId,\n\t\toptions: {\n\t\t\tconfig: {\n\t\t\t\tkey: ContextIdKeys.Node\n\t\t\t}\n\t\t}\n\t});\n\tserverConfig.types.socketRouteProcessor.push({\n\t\ttype: SocketRouteProcessorType.ContextId,\n\t\toptions: {\n\t\t\tconfig: {\n\t\t\t\tkey: ContextIdKeys.Node\n\t\t\t}\n\t\t}\n\t});\n\n\tif (tenantEnabled) {\n\t\tavailableContextIdKeys.push({\n\t\t\tkey: ContextIdKeys.Organization,\n\t\t\trequiredHandlerFeatures: [CONTEXT_ID_HANDLER_FEATURE_DID]\n\t\t});\n\t\tavailableContextIdKeys.push({\n\t\t\tkey: ContextIdKeys.Tenant,\n\t\t\trequiredHandlerFeatures: [CONTEXT_ID_HANDLER_FEATURE_TENANT]\n\t\t});\n\n\t\tserverConfig.types.restRouteProcessor.push({\n\t\t\ttype: RestRouteProcessorType.Tenant,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tapiKeyName: apiKeyHeader\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tserverConfig.types.socketRouteProcessor.push({\n\t\t\ttype: SocketRouteProcessorType.Tenant,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tapiKeyName: apiKeyHeader\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t} else {\n\t\tavailableContextIdKeys.push({\n\t\t\tkey: ContextIdKeys.Organization,\n\t\t\trequiredHandlerFeatures: [CONTEXT_ID_HANDLER_FEATURE_DID]\n\t\t});\n\n\t\tserverConfig.types.restRouteProcessor.push({\n\t\t\ttype: RestRouteProcessorType.SingleTenant\n\t\t});\n\t\tserverConfig.types.socketRouteProcessor.push({\n\t\t\ttype: SocketRouteProcessorType.SingleTenant\n\t\t});\n\t}\n\n\tif (!coreEngineConfig.silent) {\n\t\tconst includeBody = Coerce.boolean(envVars.routeLoggingIncludeBody) ?? coreEngineConfig.debug;\n\t\tconst fullBase64 = Coerce.boolean(envVars.routeLoggingFullBase64) ?? false;\n\t\tconst obfuscateProperties = commaSeparatedListToArray<string>(\n\t\t\tenvVars.routeLoggingObfuscateProperties,\n\t\t\tundefined\n\t\t);\n\t\tserverConfig.types.restRouteProcessor.push({\n\t\t\ttype: RestRouteProcessorType.Logging,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tincludeBody,\n\t\t\t\t\tfullBase64,\n\t\t\t\t\tobfuscateProperties\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tserverConfig.types.socketRouteProcessor.push({\n\t\t\ttype: SocketRouteProcessorType.Logging,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tincludeBody,\n\t\t\t\t\tfullBase64,\n\t\t\t\t\tobfuscateProperties\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\tserverConfig.types.restRouteProcessor.push({\n\t\ttype: RestRouteProcessorType.RestRoute\n\t});\n\tserverConfig.types.socketRouteProcessor.push({\n\t\ttype: SocketRouteProcessorType.SocketRoute\n\t});\n\n\tconst authAdminProcessorType = envVars.authAdminProcessorType;\n\tconst authProcessorType = envVars.authProcessorType;\n\n\tif (\n\t\tauthAdminProcessorType === AuthenticationAdminComponentType.EntityStorage ||\n\t\tauthProcessorType === AuthenticationComponentType.EntityStorage\n\t) {\n\t\tserverConfig.types.authenticationRateComponent ??= [];\n\t\tserverConfig.types.authenticationRateComponent.push({\n\t\t\ttype: AuthenticationRateComponentType.EntityStorage\n\t\t});\n\n\t\tserverConfig.types.authenticationAuditComponent ??= [];\n\t\tserverConfig.types.authenticationAuditComponent.push({\n\t\t\ttype: AuthenticationAuditComponentType.EntityStorage\n\t\t});\n\t}\n\n\tif (authAdminProcessorType === AuthenticationAdminComponentType.EntityStorage) {\n\t\tserverConfig.types.authenticationAdminComponent ??= [];\n\t\tserverConfig.types.authenticationAdminComponent.push({\n\t\t\ttype: AuthenticationAdminComponentType.EntityStorage,\n\t\t\toptions: {\n\t\t\t\tconfig: {}\n\t\t\t}\n\t\t});\n\t}\n\n\tif (authProcessorType === AuthenticationComponentType.EntityStorage) {\n\t\tavailableContextIdKeys.push({\n\t\t\tkey: ContextIdKeys.User,\n\t\t\trequiredHandlerFeatures: [CONTEXT_ID_HANDLER_FEATURE_DID]\n\t\t});\n\n\t\tserverConfig.types.authenticationComponent ??= [];\n\t\tserverConfig.types.authenticationComponent.push({\n\t\t\ttype: AuthenticationComponentType.EntityStorage,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tsigningKeyName: envVars.authSigningKeyId\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tserverConfig.types.restRouteProcessor.push({\n\t\t\ttype: RestRouteProcessorType.AuthHeader,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tsigningKeyName: envVars.authSigningKeyId\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tserverConfig.types.socketRouteProcessor.push({\n\t\t\ttype: SocketRouteProcessorType.AuthHeader,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tsigningKeyName: envVars.authSigningKeyId\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tif (tenantEnabled) {\n\t\t\tserverConfig.types.restRouteProcessor.push({\n\t\t\t\ttype: RestRouteProcessorType.TenantOverride,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {}\n\t\t\t\t}\n\t\t\t});\n\t\t\tserverConfig.types.socketRouteProcessor.push({\n\t\t\t\ttype: SocketRouteProcessorType.TenantOverride,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tif (isTelemetryRequired(envVars)) {\n\t\tserverConfig.types.restRouteProcessor.push({\n\t\t\ttype: RestRouteProcessorType.Metrics,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\texcludePaths: commaSeparatedListToArray<string>(\n\t\t\t\t\t\tenvVars.routeMetricsExcludePaths,\n\t\t\t\t\t\tundefined\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tif (isTracingRequired(envVars)) {\n\t\tserverConfig.types.restRouteProcessor.push({\n\t\t\ttype: RestRouteProcessorType.Tracing,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\texcludePaths: commaSeparatedListToArray<string>(\n\t\t\t\t\t\tenvVars.routeTracingExcludePaths,\n\t\t\t\t\t\tundefined\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\taddDefaultRestPaths(serverConfig);\n\taddDefaultSocketPaths(serverConfig);\n\n\t// See if any of the rest paths should be overridden by environment variables and update the config accordingly\n\t// Should be in the format TWIN_REST_PATH_<COMPONENT_TYPE> e.g. TWIN_REST_PATH_TENANT_ADMIN=my-tenants\n\tfor (const componentType in serverConfig.types) {\n\t\tconst types = serverConfig.types[componentType];\n\n\t\tif (Is.arrayValue(types)) {\n\t\t\tfor (const typeConfig of types) {\n\t\t\t\tif (Is.stringValue(typeConfig.restPath)) {\n\t\t\t\t\tconst envVarName = `restPath${StringHelper.pascalCase(componentType.replace(\"Component\", \"\"))}`;\n\t\t\t\t\tconst overrideRestPath = envVars[envVarName];\n\t\t\t\t\tif (Is.stringValue(overrideRestPath)) {\n\t\t\t\t\t\ttypeConfig.restPath = overrideRestPath;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn serverConfig;\n}\n\n/**\n * Checks if the authentication entity storage subsystem is required.\n * Returns true when any component that depends on the authentication entity storage subsystem is enabled.\n * @param envVars The environment variables.\n * @returns True if authentication entity storage is enabled.\n */\nexport function isAuthEntityStorageRequired(envVars: IEnvironmentVariables): boolean {\n\treturn (\n\t\tenvVars.authAdminProcessorType === AuthenticationAdminComponentType.EntityStorage ||\n\t\tenvVars.authProcessorType === AuthenticationComponentType.EntityStorage\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"engineServerEnvBuilder.js","sourceRoot":"","sources":["../../../src/builders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AAC,EAAE,CAAC;oBAChG,MAAM,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;oBAC7C,IAAI,EAAE,CAAC,WAAW,CAAC,gBAAgB,CAAC,EAAE,CAAC;wBACtC,UAAU,CAAC,QAAQ,GAAG,gBAAgB,CAAC;oBACxC,CAAC;oBACD,MAAM;gBACP,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,YAAY,CAAC;AACrB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAAC,OAA8B;IACzE,OAAO,CACN,OAAO,CAAC,sBAAsB,KAAK,gCAAgC,CAAC,aAAa;QACjF,OAAO,CAAC,iBAAiB,KAAK,2BAA2B,CAAC,aAAa,CACvE,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IServerInfo, IWebServerOptions } from \"@twin.org/api-models\";\nimport { ContextIdKeys } from \"@twin.org/context\";\nimport { Coerce, Is, StringHelper } from \"@twin.org/core\";\nimport type { IEngineCoreConfig } from \"@twin.org/engine-models\";\nimport { addDefaultRestPaths, addDefaultSocketPaths } from \"@twin.org/engine-server\";\nimport {\n\tAuthenticationAdminComponentType,\n\tAuthenticationAuditComponentType,\n\tAuthenticationComponentType,\n\tAuthenticationRateComponentType,\n\ttype IEngineServerConfig,\n\tInformationComponentType,\n\ttype MimeTypeProcessorType,\n\tRestRouteProcessorType,\n\tSocketRouteProcessorType\n} from \"@twin.org/engine-server-types\";\nimport { TraceparentHelper } from \"@twin.org/tracing-models\";\nimport { CONTEXT_ID_HANDLER_FEATURE_DID, CONTEXT_ID_HANDLER_FEATURE_TENANT } from \"../defaults.js\";\nimport { isTelemetryEnabled, isTracingEnabled } from \"./engineEnvBuilder.js\";\nimport type { IEnvironmentVariables } from \"../models/IEnvironmentVariables.js\";\nimport { commaSeparatedListToArray, envKeyIntegerPairs } from \"./helper/envHelpers.js\";\n\n/**\n * Handles the configuration of the server.\n * @param envVars The environment variables for the engine server.\n * @param availableContextIdKeys The context ID keys.\n * @param coreEngineConfig The core engine config.\n * @param serverInfo The server information.\n * @param openApiSpecPath The path to the open api spec.\n * @param favIconPath The path to the favicon.\n * @returns The config for the core and the server.\n */\nexport async function buildEngineServerConfiguration(\n\tenvVars: IEnvironmentVariables & { [id: string]: string | unknown },\n\tavailableContextIdKeys: { key: string; requiredHandlerFeatures: string[] }[],\n\tcoreEngineConfig: IEngineCoreConfig,\n\tserverInfo: IServerInfo,\n\topenApiSpecPath?: string,\n\tfavIconPath?: string\n): Promise<IEngineServerConfig> {\n\tconst webServerOptions: IWebServerOptions = {\n\t\tport: Coerce.number(envVars.port),\n\t\thost: Coerce.string(envVars.host),\n\t\tmethods: commaSeparatedListToArray(envVars.httpMethods, undefined),\n\t\tallowedHeaders: commaSeparatedListToArray(envVars.httpAllowedHeaders, undefined),\n\t\texposedHeaders: commaSeparatedListToArray(envVars.httpExposedHeaders, undefined),\n\t\tcorsOrigins: commaSeparatedListToArray(envVars.corsOrigins, undefined),\n\t\tbodyLimits: envKeyIntegerPairs(envVars, \"httpBodyLimits\"),\n\t\tpublicOrigin: Coerce.string(envVars.publicOrigin)\n\t};\n\n\tconst tenantEnabled = Coerce.boolean(envVars.tenantEnabled) ?? false;\n\tconst apiKeyHeader = envVars.authApiKeyHeader ?? \"x-api-key\";\n\tif (tenantEnabled) {\n\t\twebServerOptions.allowedHeaders ??= [];\n\t\tif (!webServerOptions.allowedHeaders.includes(apiKeyHeader)) {\n\t\t\twebServerOptions.allowedHeaders.push(apiKeyHeader);\n\t\t}\n\t}\n\n\tif (isTracingEnabled(envVars)) {\n\t\twebServerOptions.allowedHeaders ??= [];\n\t\tif (!webServerOptions.allowedHeaders.includes(TraceparentHelper.HEADER_NAME)) {\n\t\t\twebServerOptions.allowedHeaders.push(TraceparentHelper.HEADER_NAME);\n\t\t}\n\t}\n\n\tconst serverConfig: IEngineServerConfig = {\n\t\t...coreEngineConfig,\n\t\tweb: webServerOptions,\n\t\ttypes: {\n\t\t\t...coreEngineConfig.types,\n\t\t\tinformationComponent: [\n\t\t\t\t{\n\t\t\t\t\ttype: InformationComponentType.Service,\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\tserverInfo,\n\t\t\t\t\t\t\topenApiSpecPath,\n\t\t\t\t\t\t\tfavIconPath\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t}\n\t};\n\n\tif (Is.stringValue(envVars.mimeTypeProcessors)) {\n\t\tconst mimeTypeProcessors = commaSeparatedListToArray(envVars.mimeTypeProcessors);\n\n\t\tif (Is.arrayValue(mimeTypeProcessors)) {\n\t\t\tserverConfig.types.mimeTypeProcessor ??= [];\n\t\t\tfor (const mimeTypeProcessor of mimeTypeProcessors) {\n\t\t\t\tserverConfig.types.mimeTypeProcessor.push({\n\t\t\t\t\ttype: mimeTypeProcessor as MimeTypeProcessorType\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tserverConfig.types.restRouteProcessor ??= [];\n\tserverConfig.types.socketRouteProcessor ??= [];\n\n\tavailableContextIdKeys.push({\n\t\tkey: ContextIdKeys.Node,\n\t\trequiredHandlerFeatures: [CONTEXT_ID_HANDLER_FEATURE_DID]\n\t});\n\n\tserverConfig.types.restRouteProcessor.push({\n\t\ttype: RestRouteProcessorType.ContextId,\n\t\toptions: {\n\t\t\tconfig: {\n\t\t\t\tkey: ContextIdKeys.Node\n\t\t\t}\n\t\t}\n\t});\n\tserverConfig.types.socketRouteProcessor.push({\n\t\ttype: SocketRouteProcessorType.ContextId,\n\t\toptions: {\n\t\t\tconfig: {\n\t\t\t\tkey: ContextIdKeys.Node\n\t\t\t}\n\t\t}\n\t});\n\n\tif (tenantEnabled) {\n\t\tavailableContextIdKeys.push({\n\t\t\tkey: ContextIdKeys.Organization,\n\t\t\trequiredHandlerFeatures: [CONTEXT_ID_HANDLER_FEATURE_DID]\n\t\t});\n\t\tavailableContextIdKeys.push({\n\t\t\tkey: ContextIdKeys.Tenant,\n\t\t\trequiredHandlerFeatures: [CONTEXT_ID_HANDLER_FEATURE_TENANT]\n\t\t});\n\n\t\tserverConfig.types.restRouteProcessor.push({\n\t\t\ttype: RestRouteProcessorType.Tenant,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tapiKeyName: apiKeyHeader\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tserverConfig.types.socketRouteProcessor.push({\n\t\t\ttype: SocketRouteProcessorType.Tenant,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tapiKeyName: apiKeyHeader\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t} else {\n\t\tavailableContextIdKeys.push({\n\t\t\tkey: ContextIdKeys.Organization,\n\t\t\trequiredHandlerFeatures: [CONTEXT_ID_HANDLER_FEATURE_DID]\n\t\t});\n\n\t\tserverConfig.types.restRouteProcessor.push({\n\t\t\ttype: RestRouteProcessorType.SingleTenant\n\t\t});\n\t\tserverConfig.types.socketRouteProcessor.push({\n\t\t\ttype: SocketRouteProcessorType.SingleTenant\n\t\t});\n\t}\n\n\tif (!coreEngineConfig.silent) {\n\t\tconst includeBody = Coerce.boolean(envVars.routeLoggingIncludeBody) ?? coreEngineConfig.debug;\n\t\tconst fullBase64 = Coerce.boolean(envVars.routeLoggingFullBase64) ?? false;\n\t\tconst obfuscateProperties = commaSeparatedListToArray<string>(\n\t\t\tenvVars.routeLoggingObfuscateProperties,\n\t\t\tundefined\n\t\t);\n\t\tserverConfig.types.restRouteProcessor.push({\n\t\t\ttype: RestRouteProcessorType.Logging,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tincludeBody,\n\t\t\t\t\tfullBase64,\n\t\t\t\t\tobfuscateProperties\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tserverConfig.types.socketRouteProcessor.push({\n\t\t\ttype: SocketRouteProcessorType.Logging,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tincludeBody,\n\t\t\t\t\tfullBase64,\n\t\t\t\t\tobfuscateProperties\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\tserverConfig.types.restRouteProcessor.push({\n\t\ttype: RestRouteProcessorType.RestRoute\n\t});\n\tserverConfig.types.socketRouteProcessor.push({\n\t\ttype: SocketRouteProcessorType.SocketRoute\n\t});\n\n\tconst authAdminProcessorType = envVars.authAdminProcessorType;\n\tconst authProcessorType = envVars.authProcessorType;\n\n\tif (\n\t\tauthAdminProcessorType === AuthenticationAdminComponentType.EntityStorage ||\n\t\tauthProcessorType === AuthenticationComponentType.EntityStorage\n\t) {\n\t\tserverConfig.types.authenticationRateComponent ??= [];\n\t\tserverConfig.types.authenticationRateComponent.push({\n\t\t\ttype: AuthenticationRateComponentType.EntityStorage\n\t\t});\n\n\t\tserverConfig.types.authenticationAuditComponent ??= [];\n\t\tserverConfig.types.authenticationAuditComponent.push({\n\t\t\ttype: AuthenticationAuditComponentType.EntityStorage\n\t\t});\n\t}\n\n\tif (authAdminProcessorType === AuthenticationAdminComponentType.EntityStorage) {\n\t\tserverConfig.types.authenticationAdminComponent ??= [];\n\t\tserverConfig.types.authenticationAdminComponent.push({\n\t\t\ttype: AuthenticationAdminComponentType.EntityStorage,\n\t\t\toptions: {\n\t\t\t\tconfig: {}\n\t\t\t}\n\t\t});\n\t}\n\n\tif (authProcessorType === AuthenticationComponentType.EntityStorage) {\n\t\tavailableContextIdKeys.push({\n\t\t\tkey: ContextIdKeys.User,\n\t\t\trequiredHandlerFeatures: [CONTEXT_ID_HANDLER_FEATURE_DID]\n\t\t});\n\n\t\tserverConfig.types.authenticationComponent ??= [];\n\t\tserverConfig.types.authenticationComponent.push({\n\t\t\ttype: AuthenticationComponentType.EntityStorage,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tsigningKeyName: envVars.authSigningKeyId\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tserverConfig.types.restRouteProcessor.push({\n\t\t\ttype: RestRouteProcessorType.AuthHeader,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tsigningKeyName: envVars.authSigningKeyId\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tserverConfig.types.socketRouteProcessor.push({\n\t\t\ttype: SocketRouteProcessorType.AuthHeader,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tsigningKeyName: envVars.authSigningKeyId\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tif (tenantEnabled) {\n\t\t\tserverConfig.types.restRouteProcessor.push({\n\t\t\t\ttype: RestRouteProcessorType.TenantOverride,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {}\n\t\t\t\t}\n\t\t\t});\n\t\t\tserverConfig.types.socketRouteProcessor.push({\n\t\t\t\ttype: SocketRouteProcessorType.TenantOverride,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tif (isTelemetryEnabled(envVars)) {\n\t\tserverConfig.types.restRouteProcessor.push({\n\t\t\ttype: RestRouteProcessorType.Metrics,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\texcludePaths: commaSeparatedListToArray<string>(\n\t\t\t\t\t\tenvVars.routeMetricsExcludePaths,\n\t\t\t\t\t\tundefined\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tif (isTracingEnabled(envVars)) {\n\t\tserverConfig.types.restRouteProcessor.push({\n\t\t\ttype: RestRouteProcessorType.Tracing,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\texcludePaths: commaSeparatedListToArray<string>(\n\t\t\t\t\t\tenvVars.routeTracingExcludePaths,\n\t\t\t\t\t\tundefined\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\taddDefaultRestPaths(serverConfig);\n\taddDefaultSocketPaths(serverConfig);\n\n\t// See if any of the rest paths should be overridden by environment variables and update the config accordingly\n\t// Should be in the format TWIN_REST_PATH_<COMPONENT_TYPE> e.g. TWIN_REST_PATH_TENANT_ADMIN=my-tenants\n\tfor (const componentType in serverConfig.types) {\n\t\tconst types = serverConfig.types[componentType];\n\n\t\tif (Is.arrayValue(types)) {\n\t\t\tfor (const typeConfig of types) {\n\t\t\t\tif (Is.stringValue(typeConfig.restPath)) {\n\t\t\t\t\tconst envVarName = `restPath${StringHelper.pascalCase(componentType.replace(\"Component\", \"\"))}`;\n\t\t\t\t\tconst overrideRestPath = envVars[envVarName];\n\t\t\t\t\tif (Is.stringValue(overrideRestPath)) {\n\t\t\t\t\t\ttypeConfig.restPath = overrideRestPath;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn serverConfig;\n}\n\n/**\n * Checks if the authentication entity storage subsystem is required.\n * Returns true when any component that depends on the authentication entity storage subsystem is enabled.\n * @param envVars The environment variables.\n * @returns True if authentication entity storage is enabled.\n */\nexport function isAuthEntityStorageRequired(envVars: IEnvironmentVariables): boolean {\n\treturn (\n\t\tenvVars.authAdminProcessorType === AuthenticationAdminComponentType.EntityStorage ||\n\t\tenvVars.authProcessorType === AuthenticationComponentType.EntityStorage\n\t);\n}\n"]}
|
|
@@ -12,17 +12,10 @@ export function envBoolean(envVars, key, defaultValue) {
|
|
|
12
12
|
}
|
|
13
13
|
return result;
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
* Coerces an env var that is already in milliseconds to an integer.
|
|
17
|
-
* @param envVars The environment variables object.
|
|
18
|
-
* @param key The property name of the env var to coerce.
|
|
19
|
-
* @returns The millisecond value, or undefined when not set.
|
|
20
|
-
* @throws GeneralError if the value is set but cannot be coerced to an integer.
|
|
21
|
-
*/
|
|
22
|
-
export function envMs(envVars, key) {
|
|
15
|
+
export function envMs(envVars, key, defaultValue) {
|
|
23
16
|
const value = envVars[key];
|
|
24
17
|
if (!Is.stringValue(value)) {
|
|
25
|
-
return
|
|
18
|
+
return defaultValue;
|
|
26
19
|
}
|
|
27
20
|
const result = Coerce.integer(value);
|
|
28
21
|
if (Is.empty(result)) {
|
|
@@ -30,17 +23,10 @@ export function envMs(envVars, key) {
|
|
|
30
23
|
}
|
|
31
24
|
return result;
|
|
32
25
|
}
|
|
33
|
-
|
|
34
|
-
* Coerces an env var that represents an integer count or size to an integer.
|
|
35
|
-
* @param envVars The environment variables object.
|
|
36
|
-
* @param key The property name of the env var to coerce.
|
|
37
|
-
* @returns The count, or undefined when not set.
|
|
38
|
-
* @throws GeneralError if the value is set but cannot be coerced to an integer.
|
|
39
|
-
*/
|
|
40
|
-
export function envCount(envVars, key) {
|
|
26
|
+
export function envCount(envVars, key, defaultValue) {
|
|
41
27
|
const value = envVars[key];
|
|
42
28
|
if (!Is.stringValue(value)) {
|
|
43
|
-
return
|
|
29
|
+
return defaultValue;
|
|
44
30
|
}
|
|
45
31
|
const result = Coerce.integer(value);
|
|
46
32
|
if (Is.empty(result)) {
|
|
@@ -48,17 +34,10 @@ export function envCount(envVars, key) {
|
|
|
48
34
|
}
|
|
49
35
|
return result;
|
|
50
36
|
}
|
|
51
|
-
|
|
52
|
-
* Coerces an env var that represents an integer to an actual integer.
|
|
53
|
-
* @param envVars The environment variables object.
|
|
54
|
-
* @param key The property name of the env var to coerce.
|
|
55
|
-
* @returns The integer, or undefined when not set.
|
|
56
|
-
* @throws GeneralError if the value is set but cannot be coerced to an integer.
|
|
57
|
-
*/
|
|
58
|
-
export function envInteger(envVars, key) {
|
|
37
|
+
export function envInteger(envVars, key, defaultValue) {
|
|
59
38
|
const value = envVars[key];
|
|
60
39
|
if (!Is.stringValue(value)) {
|
|
61
|
-
return
|
|
40
|
+
return defaultValue;
|
|
62
41
|
}
|
|
63
42
|
const result = Coerce.integer(value);
|
|
64
43
|
if (Is.empty(result)) {
|
|
@@ -66,17 +45,24 @@ export function envInteger(envVars, key) {
|
|
|
66
45
|
}
|
|
67
46
|
return result;
|
|
68
47
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
export function
|
|
48
|
+
export function envObject(envVars, key, defaultValue) {
|
|
49
|
+
const value = envVars[key];
|
|
50
|
+
if (Is.undefined(value)) {
|
|
51
|
+
return defaultValue;
|
|
52
|
+
}
|
|
53
|
+
return Coerce.object(value) ?? defaultValue;
|
|
54
|
+
}
|
|
55
|
+
export function envArray(envVars, key, defaultValue) {
|
|
56
|
+
const value = envVars[key];
|
|
57
|
+
if (Is.undefined(value)) {
|
|
58
|
+
return defaultValue;
|
|
59
|
+
}
|
|
60
|
+
return Coerce.array(value) ?? defaultValue;
|
|
61
|
+
}
|
|
62
|
+
export function envSeconds(envVars, key, defaultValue) {
|
|
77
63
|
const value = envVars[key];
|
|
78
64
|
if (!Is.stringValue(value)) {
|
|
79
|
-
return
|
|
65
|
+
return defaultValue;
|
|
80
66
|
}
|
|
81
67
|
const result = Coerce.integer(value);
|
|
82
68
|
if (Is.empty(result)) {
|
|
@@ -84,17 +70,10 @@ export function envSeconds(envVars, key) {
|
|
|
84
70
|
}
|
|
85
71
|
return result;
|
|
86
72
|
}
|
|
87
|
-
|
|
88
|
-
* Coerces an env var that is already in minutes to an integer.
|
|
89
|
-
* @param envVars The environment variables object.
|
|
90
|
-
* @param key The property name of the env var to coerce.
|
|
91
|
-
* @returns The minute value, or undefined when not set.
|
|
92
|
-
* @throws GeneralError if the value is set but cannot be coerced to an integer.
|
|
93
|
-
*/
|
|
94
|
-
export function envMinutes(envVars, key) {
|
|
73
|
+
export function envMinutes(envVars, key, defaultValue) {
|
|
95
74
|
const value = envVars[key];
|
|
96
75
|
if (!Is.stringValue(value)) {
|
|
97
|
-
return
|
|
76
|
+
return defaultValue;
|
|
98
77
|
}
|
|
99
78
|
const result = Coerce.integer(value);
|
|
100
79
|
if (Is.empty(result)) {
|
|
@@ -102,17 +81,10 @@ export function envMinutes(envVars, key) {
|
|
|
102
81
|
}
|
|
103
82
|
return result;
|
|
104
83
|
}
|
|
105
|
-
|
|
106
|
-
* Coerces an env var that is a datetime string, throwing when the value is set but not a valid datetime.
|
|
107
|
-
* @param envVars The environment variables object.
|
|
108
|
-
* @param key The property name of the env var to coerce.
|
|
109
|
-
* @returns The datetime string, or undefined when not set.
|
|
110
|
-
* @throws GeneralError if the value is set but cannot be coerced to a datetime.
|
|
111
|
-
*/
|
|
112
|
-
export function envDateTime(envVars, key) {
|
|
84
|
+
export function envDateTime(envVars, key, defaultValue) {
|
|
113
85
|
const value = envVars[key];
|
|
114
86
|
if (!Is.stringValue(value)) {
|
|
115
|
-
return
|
|
87
|
+
return defaultValue;
|
|
116
88
|
}
|
|
117
89
|
const result = Coerce.dateTime(value) ?? Coerce.date(value);
|
|
118
90
|
if (Is.empty(result)) {
|
|
@@ -120,17 +92,10 @@ export function envDateTime(envVars, key) {
|
|
|
120
92
|
}
|
|
121
93
|
return result.toISOString();
|
|
122
94
|
}
|
|
123
|
-
|
|
124
|
-
* Coerces an env var to an integer and converts from seconds to milliseconds.
|
|
125
|
-
* @param envVars The environment variables object.
|
|
126
|
-
* @param key The property name of the env var to coerce.
|
|
127
|
-
* @returns The value in milliseconds, or undefined when not set.
|
|
128
|
-
* @throws GeneralError if the value is set but cannot be coerced to an integer.
|
|
129
|
-
*/
|
|
130
|
-
export function envSecToMs(envVars, key) {
|
|
95
|
+
export function envSecToMs(envVars, key, defaultValue) {
|
|
131
96
|
const value = envVars[key];
|
|
132
97
|
if (!Is.stringValue(value)) {
|
|
133
|
-
return
|
|
98
|
+
return defaultValue;
|
|
134
99
|
}
|
|
135
100
|
const n = Coerce.integer(value);
|
|
136
101
|
if (Is.empty(n)) {
|
|
@@ -138,17 +103,10 @@ export function envSecToMs(envVars, key) {
|
|
|
138
103
|
}
|
|
139
104
|
return n * 1000;
|
|
140
105
|
}
|
|
141
|
-
|
|
142
|
-
* Coerces an env var to an integer and converts from minutes to milliseconds.
|
|
143
|
-
* @param envVars The environment variables object.
|
|
144
|
-
* @param key The property name of the env var to coerce.
|
|
145
|
-
* @returns The value in milliseconds, or undefined when not set.
|
|
146
|
-
* @throws GeneralError if the value is set but cannot be coerced to an integer.
|
|
147
|
-
*/
|
|
148
|
-
export function envMinToMs(envVars, key) {
|
|
106
|
+
export function envMinToMs(envVars, key, defaultValue) {
|
|
149
107
|
const value = envVars[key];
|
|
150
108
|
if (!Is.stringValue(value)) {
|
|
151
|
-
return
|
|
109
|
+
return defaultValue;
|
|
152
110
|
}
|
|
153
111
|
const n = Coerce.integer(value);
|
|
154
112
|
if (Is.empty(n)) {
|
|
@@ -171,4 +129,31 @@ export function commaSeparatedListToArray(value, defaultValue = []) {
|
|
|
171
129
|
.map(item => item.trim())
|
|
172
130
|
.filter(item => item.length > 0);
|
|
173
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Gets named key integer pairs from an env var holding comma separated key=integer pairs.
|
|
134
|
+
* @param envVars The environment variables object.
|
|
135
|
+
* @param key The property name of the env var to read.
|
|
136
|
+
* @returns The named key integer pairs, or undefined when the env var is absent or empty.
|
|
137
|
+
* @throws GeneralError if an entry is not a unique name=value pair with an integer value.
|
|
138
|
+
*/
|
|
139
|
+
export function envKeyIntegerPairs(envVars, key) {
|
|
140
|
+
const entries = commaSeparatedListToArray(envVars[key], undefined);
|
|
141
|
+
if (!Is.arrayValue(entries)) {
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
const keyValues = {};
|
|
145
|
+
for (const entry of entries) {
|
|
146
|
+
const parts = entry.split("=").map(part => part.trim());
|
|
147
|
+
const keyPart = parts[0];
|
|
148
|
+
const valuePart = Coerce.integer(parts[1]);
|
|
149
|
+
if (parts.length !== 2 ||
|
|
150
|
+
!Is.stringValue(keyPart) ||
|
|
151
|
+
!Is.integer(valuePart) ||
|
|
152
|
+
!Is.undefined(keyValues[keyPart])) {
|
|
153
|
+
throw new GeneralError("node", "invalidEnvVarPair", { key: keyPart, value: entry });
|
|
154
|
+
}
|
|
155
|
+
keyValues[keyPart] = valuePart;
|
|
156
|
+
}
|
|
157
|
+
return keyValues;
|
|
158
|
+
}
|
|
174
159
|
//# sourceMappingURL=envHelpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envHelpers.js","sourceRoot":"","sources":["../../../../src/builders/helper/envHelpers.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAoB1D,MAAM,UAAU,UAAU,CACzB,OAAoC,EACpC,GAAsC,EACtC,YAAsB;IAEtB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3B,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,YAAY,CAAC;IACrB,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACrC,IAAI,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,YAAY,CAAC,MAAM,EAAE,oBAAoB,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;IACvF,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,KAAK,CACpB,OAAoC,EACpC,GAAsC;IAEtC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3B,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACrC,IAAI,EAAE,CAAC,KAA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,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QACjB,MAAM,IAAI,YAAY,CAAC,MAAM,EAAE,oBAAoB,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;IACvF,CAAC;IACD,OAAO,CAAC,GAAG,MAAM,CAAC;AACnB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CACxC,KAAyB,EACzB,eAAgC,EAAE;IAElC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,YAAY,CAAC;IACrB,CAAC;IACD,OAAO,KAAK;SACV,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SACxB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAQ,CAAC;AAC1C,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Coerce, GeneralError, Is } from \"@twin.org/core\";\nimport type { IEngineEnvironmentVariables } from \"../../models/IEngineEnvironmentVariables.js\";\n\n/**\n * Coerces an env var to a boolean, falling back to the supplied default when not set.\n * @param envVars The environment variables object.\n * @param key The property name of the env var to coerce.\n * @param defaultValue The value to return when the env var is absent. Omit to return undefined when absent.\n * @returns The boolean value, the default, or undefined when absent and no default given.\n * @throws GeneralError if the value is set but cannot be coerced to a boolean.\n */\nexport function envBoolean(\n\tenvVars: IEngineEnvironmentVariables,\n\tkey: keyof IEngineEnvironmentVariables,\n\tdefaultValue: boolean\n): boolean;\nexport function envBoolean(\n\tenvVars: IEngineEnvironmentVariables,\n\tkey: keyof IEngineEnvironmentVariables\n): boolean | undefined;\nexport function envBoolean(\n\tenvVars: IEngineEnvironmentVariables,\n\tkey: keyof IEngineEnvironmentVariables,\n\tdefaultValue?: boolean\n): boolean | undefined {\n\tconst value = envVars[key];\n\tif (!Is.stringValue(value)) {\n\t\treturn defaultValue;\n\t}\n\tconst result = Coerce.boolean(value);\n\tif (Is.empty(result)) {\n\t\tthrow new GeneralError(\"node\", \"invalidEnvVarValue\", { key, value, type: \"boolean\" });\n\t}\n\treturn result;\n}\n\n/**\n * Coerces an env var that is already in milliseconds to an integer.\n * @param envVars The environment variables object.\n * @param key The property name of the env var to coerce.\n * @returns The millisecond value, or undefined when not set.\n * @throws GeneralError if the value is set but cannot be coerced to an integer.\n */\nexport function envMs(\n\tenvVars: IEngineEnvironmentVariables,\n\tkey: keyof IEngineEnvironmentVariables\n): number | undefined {\n\tconst value = envVars[key];\n\tif (!Is.stringValue(value)) {\n\t\treturn undefined;\n\t}\n\tconst result = Coerce.integer(value);\n\tif (Is.empty(result)) {\n\t\tthrow new GeneralError(\"node\", \"invalidEnvVarValue\", { key, value, type: \"integer\" });\n\t}\n\treturn result;\n}\n\n/**\n * Coerces an env var that represents an integer count or size to an integer.\n * @param envVars The environment variables object.\n * @param key The property name of the env var to coerce.\n * @returns The count, or undefined when not set.\n * @throws GeneralError if the value is set but cannot be coerced to an integer.\n */\nexport function envCount(\n\tenvVars: IEngineEnvironmentVariables,\n\tkey: keyof IEngineEnvironmentVariables\n): number | undefined {\n\tconst value = envVars[key];\n\tif (!Is.stringValue(value)) {\n\t\treturn undefined;\n\t}\n\tconst result = Coerce.integer(value);\n\tif (Is.empty(result)) {\n\t\tthrow new GeneralError(\"node\", \"invalidEnvVarValue\", { key, value, type: \"integer\" });\n\t}\n\treturn result;\n}\n\n/**\n * Coerces an env var that represents an integer to an actual integer.\n * @param envVars The environment variables object.\n * @param key The property name of the env var to coerce.\n * @returns The integer, or undefined when not set.\n * @throws GeneralError if the value is set but cannot be coerced to an integer.\n */\nexport function envInteger(\n\tenvVars: IEngineEnvironmentVariables,\n\tkey: keyof IEngineEnvironmentVariables\n): number | undefined {\n\tconst value = envVars[key];\n\tif (!Is.stringValue(value)) {\n\t\treturn undefined;\n\t}\n\tconst result = Coerce.integer(value);\n\tif (Is.empty(result)) {\n\t\tthrow new GeneralError(\"node\", \"invalidEnvVarValue\", { key, value, type: \"integer\" });\n\t}\n\treturn result;\n}\n\n/**\n * Coerces an env var that is already in seconds to an integer.\n * @param envVars The environment variables object.\n * @param key The property name of the env var to coerce.\n * @returns The second value, or undefined when not set.\n * @throws GeneralError if the value is set but cannot be coerced to an integer.\n */\nexport function envSeconds(\n\tenvVars: IEngineEnvironmentVariables,\n\tkey: keyof IEngineEnvironmentVariables\n): number | undefined {\n\tconst value = envVars[key];\n\tif (!Is.stringValue(value)) {\n\t\treturn undefined;\n\t}\n\tconst result = Coerce.integer(value);\n\tif (Is.empty(result)) {\n\t\tthrow new GeneralError(\"node\", \"invalidEnvVarValue\", { key, value, type: \"integer\" });\n\t}\n\treturn result;\n}\n\n/**\n * Coerces an env var that is already in minutes to an integer.\n * @param envVars The environment variables object.\n * @param key The property name of the env var to coerce.\n * @returns The minute value, or undefined when not set.\n * @throws GeneralError if the value is set but cannot be coerced to an integer.\n */\nexport function envMinutes(\n\tenvVars: IEngineEnvironmentVariables,\n\tkey: keyof IEngineEnvironmentVariables\n): number | undefined {\n\tconst value = envVars[key];\n\tif (!Is.stringValue(value)) {\n\t\treturn undefined;\n\t}\n\tconst result = Coerce.integer(value);\n\tif (Is.empty(result)) {\n\t\tthrow new GeneralError(\"node\", \"invalidEnvVarValue\", { key, value, type: \"integer\" });\n\t}\n\treturn result;\n}\n\n/**\n * Coerces an env var that is a datetime string, throwing when the value is set but not a valid datetime.\n * @param envVars The environment variables object.\n * @param key The property name of the env var to coerce.\n * @returns The datetime string, or undefined when not set.\n * @throws GeneralError if the value is set but cannot be coerced to a datetime.\n */\nexport function envDateTime(\n\tenvVars: IEngineEnvironmentVariables,\n\tkey: keyof IEngineEnvironmentVariables\n): string | undefined {\n\tconst value = envVars[key];\n\tif (!Is.stringValue(value)) {\n\t\treturn undefined;\n\t}\n\tconst result = Coerce.dateTime(value) ?? Coerce.date(value);\n\tif (Is.empty(result)) {\n\t\tthrow new GeneralError(\"node\", \"invalidEnvVarValue\", { key, value, type: \"datetime\" });\n\t}\n\treturn result.toISOString();\n}\n\n/**\n * Coerces an env var to an integer and converts from seconds to milliseconds.\n * @param envVars The environment variables object.\n * @param key The property name of the env var to coerce.\n * @returns The value in milliseconds, or undefined when not set.\n * @throws GeneralError if the value is set but cannot be coerced to an integer.\n */\nexport function envSecToMs(\n\tenvVars: IEngineEnvironmentVariables,\n\tkey: keyof IEngineEnvironmentVariables\n): number | undefined {\n\tconst value = envVars[key];\n\tif (!Is.stringValue(value)) {\n\t\treturn undefined;\n\t}\n\tconst n = Coerce.integer(value);\n\tif (Is.empty(n)) {\n\t\tthrow new GeneralError(\"node\", \"invalidEnvVarValue\", { key, value, type: \"integer\" });\n\t}\n\treturn n * 1000;\n}\n\n/**\n * Coerces an env var to an integer and converts from minutes to milliseconds.\n * @param envVars The environment variables object.\n * @param key The property name of the env var to coerce.\n * @returns The value in milliseconds, or undefined when not set.\n * @throws GeneralError if the value is set but cannot be coerced to an integer.\n */\nexport function envMinToMs(\n\tenvVars: IEngineEnvironmentVariables,\n\tkey: keyof IEngineEnvironmentVariables\n): number | undefined {\n\tconst value = envVars[key];\n\tif (!Is.stringValue(value)) {\n\t\treturn undefined;\n\t}\n\tconst n = Coerce.integer(value);\n\tif (Is.empty(n)) {\n\t\tthrow new GeneralError(\"node\", \"invalidEnvVarValue\", { key, value, type: \"integer\" });\n\t}\n\treturn n * 60_000;\n}\n\n/**\n * Converts a comma separated list to an array.\n * @param value The comma separated list.\n * @param defaultValue The default value to return when the list is empty or undefined.\n * @returns The array.\n */\nexport function commaSeparatedListToArray<T>(\n\tvalue: string | undefined,\n\tdefaultValue: T[] | undefined = []\n): T[] {\n\tif (!Is.stringValue(value)) {\n\t\treturn defaultValue;\n\t}\n\treturn value\n\t\t.split(\",\")\n\t\t.map(item => item.trim())\n\t\t.filter(item => item.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IAClB,CAAC;IAED,MAAM,SAAS,GAA+B,EAAE,CAAC;IACjD,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAExD,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3C,IACC,KAAK,CAAC,MAAM,KAAK,CAAC;YAClB,CAAC,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC;YACxB,CAAC,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC;YACtB,CAAC,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,EAChC,CAAC;YACF,MAAM,IAAI,YAAY,CAAC,MAAM,EAAE,mBAAmB,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACrF,CAAC;QACD,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;IAChC,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Coerce, GeneralError, Is } from \"@twin.org/core\";\n\n/**\n * Coerces an env var to a boolean, falling back to the supplied default when not set.\n * @param envVars The environment variables object.\n * @param key The property name of the env var to coerce.\n * @param defaultValue The value to return when the env var is absent. Omit to return undefined when absent.\n * @returns The boolean value, the default, or undefined when absent and no default given.\n * @throws GeneralError if the value is set but cannot be coerced to a boolean.\n */\nexport function envBoolean<T>(envVars: T, key: keyof T, defaultValue: boolean): boolean;\nexport function envBoolean<T>(envVars: T, key: keyof T): boolean | undefined;\nexport function envBoolean<T>(\n\tenvVars: T,\n\tkey: keyof T,\n\tdefaultValue?: boolean\n): boolean | undefined {\n\tconst value = envVars[key];\n\tif (!Is.stringValue(value)) {\n\t\treturn defaultValue;\n\t}\n\tconst result = Coerce.boolean(value);\n\tif (Is.empty(result)) {\n\t\tthrow new GeneralError(\"node\", \"invalidEnvVarValue\", { key, value, type: \"boolean\" });\n\t}\n\treturn result;\n}\n\n/**\n * Coerces an env var that is already in milliseconds to an integer.\n * @param envVars The environment variables object.\n * @param key The property name of the env var to coerce.\n * @param defaultValue The value to return when the env var is absent. Omit to return undefined when absent.\n * @returns The millisecond value, the default, or undefined when absent and no default given.\n * @throws GeneralError if the value is set but cannot be coerced to an integer.\n */\nexport function envMs<T>(envVars: T, key: keyof T, defaultValue: number): number;\nexport function envMs<T>(envVars: T, key: keyof T): number | undefined;\nexport function envMs<T>(envVars: T, key: keyof T, defaultValue?: number): number | undefined {\n\tconst value = envVars[key];\n\tif (!Is.stringValue(value)) {\n\t\treturn defaultValue;\n\t}\n\tconst result = Coerce.integer(value);\n\tif (Is.empty(result)) {\n\t\tthrow new GeneralError(\"node\", \"invalidEnvVarValue\", { key, value, type: \"integer\" });\n\t}\n\treturn result;\n}\n\n/**\n * Coerces an env var that represents an integer count or size to an integer.\n * @param envVars The environment variables object.\n * @param key The property name of the env var to coerce.\n * @param defaultValue The value to return when the env var is absent. Omit to return undefined when absent.\n * @returns The count, the default, or undefined when absent and no default given.\n * @throws GeneralError if the value is set but cannot be coerced to an integer.\n */\nexport function envCount<T>(envVars: T, key: keyof T, defaultValue: number): number;\nexport function envCount<T>(envVars: T, key: keyof T): number | undefined;\nexport function envCount<T>(envVars: T, key: keyof T, defaultValue?: number): number | undefined {\n\tconst value = envVars[key];\n\tif (!Is.stringValue(value)) {\n\t\treturn defaultValue;\n\t}\n\tconst result = Coerce.integer(value);\n\tif (Is.empty(result)) {\n\t\tthrow new GeneralError(\"node\", \"invalidEnvVarValue\", { key, value, type: \"integer\" });\n\t}\n\treturn result;\n}\n\n/**\n * Coerces an env var that represents an integer to an actual integer.\n * @param envVars The environment variables object.\n * @param key The property name of the env var to coerce.\n * @param defaultValue The value to return when the env var is absent. Omit to return undefined when absent.\n * @returns The integer, the default, or undefined when absent and no default given.\n * @throws GeneralError if the value is set but cannot be coerced to an integer.\n */\nexport function envInteger<T>(envVars: T, key: keyof T, defaultValue: number): number;\nexport function envInteger<T>(envVars: T, key: keyof T): number | undefined;\nexport function envInteger<T>(envVars: T, key: keyof T, defaultValue?: number): number | undefined {\n\tconst value = envVars[key];\n\tif (!Is.stringValue(value)) {\n\t\treturn defaultValue;\n\t}\n\tconst result = Coerce.integer(value);\n\tif (Is.empty(result)) {\n\t\tthrow new GeneralError(\"node\", \"invalidEnvVarValue\", { key, value, type: \"integer\" });\n\t}\n\treturn result;\n}\n\n/**\n * Returns an env var as a typed object. Accepts a pre-parsed object, an inline JSON object string,\n * or a value already expanded from a @json: file reference.\n * @param envVars The environment variables object.\n * @param key The property name of the env var to coerce.\n * @param defaultValue The value to return when the env var is absent or cannot be parsed.\n * @returns The parsed object, or the default when absent or the value cannot be parsed.\n */\nexport function envObject<T, U>(envVars: T, key: keyof T, defaultValue: U): U;\n/**\n * Returns an env var as a typed object. Accepts a pre-parsed object, an inline JSON object string,\n * or a value already expanded from a @json: file reference.\n * @param envVars The environment variables object.\n * @param key The property name of the env var to coerce.\n * @returns The parsed object, or undefined when the var is absent or the value cannot be parsed.\n */\nexport function envObject<T, U>(envVars: T, key: keyof T): U | undefined;\nexport function envObject<T, U>(envVars: T, key: keyof T, defaultValue?: U): U | undefined {\n\tconst value: unknown = envVars[key];\n\tif (Is.undefined(value)) {\n\t\treturn defaultValue;\n\t}\n\treturn Coerce.object<U>(value) ?? defaultValue;\n}\n\n/**\n * Returns an env var as a typed array. Accepts a pre-parsed array, an inline JSON array string,\n * or a value already expanded from a @json: file reference.\n * @param envVars The environment variables object.\n * @param key The property name of the env var to coerce.\n * @param defaultValue The value to return when the env var is absent or cannot be parsed.\n * @returns The parsed array, or the default when absent or the value cannot be parsed.\n */\nexport function envArray<T, U>(envVars: T, key: keyof T, defaultValue: U[]): U[];\n/**\n * Returns an env var as a typed array. Accepts a pre-parsed array, an inline JSON array string,\n * or a value already expanded from a @json: file reference.\n * @param envVars The environment variables object.\n * @param key The property name of the env var to coerce.\n * @returns The parsed array, or undefined when the var is absent or the value cannot be parsed.\n */\nexport function envArray<T, U>(envVars: T, key: keyof T): U[] | undefined;\nexport function envArray<T, U>(envVars: T, key: keyof T, defaultValue?: U[]): U[] | undefined {\n\tconst value: unknown = envVars[key];\n\tif (Is.undefined(value)) {\n\t\treturn defaultValue;\n\t}\n\treturn Coerce.array<U>(value) ?? defaultValue;\n}\n\n/**\n * Coerces an env var that is already in seconds to an integer.\n * @param envVars The environment variables object.\n * @param key The property name of the env var to coerce.\n * @param defaultValue The value to return when the env var is absent. Omit to return undefined when absent.\n * @returns The second value, the default, or undefined when absent and no default given.\n * @throws GeneralError if the value is set but cannot be coerced to an integer.\n */\nexport function envSeconds<T>(envVars: T, key: keyof T, defaultValue: number): number;\nexport function envSeconds<T>(envVars: T, key: keyof T): number | undefined;\nexport function envSeconds<T>(envVars: T, key: keyof T, defaultValue?: number): number | undefined {\n\tconst value = envVars[key];\n\tif (!Is.stringValue(value)) {\n\t\treturn defaultValue;\n\t}\n\tconst result = Coerce.integer(value);\n\tif (Is.empty(result)) {\n\t\tthrow new GeneralError(\"node\", \"invalidEnvVarValue\", { key, value, type: \"integer\" });\n\t}\n\treturn result;\n}\n\n/**\n * Coerces an env var that is already in minutes to an integer.\n * @param envVars The environment variables object.\n * @param key The property name of the env var to coerce.\n * @param defaultValue The value to return when the env var is absent. Omit to return undefined when absent.\n * @returns The minute value, the default, or undefined when absent and no default given.\n * @throws GeneralError if the value is set but cannot be coerced to an integer.\n */\nexport function envMinutes<T>(envVars: T, key: keyof T, defaultValue: number): number;\nexport function envMinutes<T>(envVars: T, key: keyof T): number | undefined;\nexport function envMinutes<T>(envVars: T, key: keyof T, defaultValue?: number): number | undefined {\n\tconst value = envVars[key];\n\tif (!Is.stringValue(value)) {\n\t\treturn defaultValue;\n\t}\n\tconst result = Coerce.integer(value);\n\tif (Is.empty(result)) {\n\t\tthrow new GeneralError(\"node\", \"invalidEnvVarValue\", { key, value, type: \"integer\" });\n\t}\n\treturn result;\n}\n\n/**\n * Coerces an env var that is a datetime string, throwing when the value is set but not a valid datetime.\n * @param envVars The environment variables object.\n * @param key The property name of the env var to coerce.\n * @param defaultValue The value to return when the env var is absent. Omit to return undefined when absent.\n * @returns The datetime ISO string, the default, or undefined when absent and no default given.\n * @throws GeneralError if the value is set but cannot be coerced to a datetime.\n */\nexport function envDateTime<T>(envVars: T, key: keyof T, defaultValue: string): string;\nexport function envDateTime<T>(envVars: T, key: keyof T): string | undefined;\nexport function envDateTime<T>(\n\tenvVars: T,\n\tkey: keyof T,\n\tdefaultValue?: string\n): string | undefined {\n\tconst value = envVars[key];\n\tif (!Is.stringValue(value)) {\n\t\treturn defaultValue;\n\t}\n\tconst result = Coerce.dateTime(value) ?? Coerce.date(value);\n\tif (Is.empty(result)) {\n\t\tthrow new GeneralError(\"node\", \"invalidEnvVarValue\", { key, value, type: \"datetime\" });\n\t}\n\treturn result.toISOString();\n}\n\n/**\n * Coerces an env var to an integer and converts from seconds to milliseconds.\n * @param envVars The environment variables object.\n * @param key The property name of the env var to coerce.\n * @param defaultValue The value to return when the env var is absent. Omit to return undefined when absent.\n * @returns The value in milliseconds, the default, or undefined when absent and no default given.\n * @throws GeneralError if the value is set but cannot be coerced to an integer.\n */\nexport function envSecToMs<T>(envVars: T, key: keyof T, defaultValue: number): number;\nexport function envSecToMs<T>(envVars: T, key: keyof T): number | undefined;\nexport function envSecToMs<T>(envVars: T, key: keyof T, defaultValue?: number): number | undefined {\n\tconst value = envVars[key];\n\tif (!Is.stringValue(value)) {\n\t\treturn defaultValue;\n\t}\n\tconst n = Coerce.integer(value);\n\tif (Is.empty(n)) {\n\t\tthrow new GeneralError(\"node\", \"invalidEnvVarValue\", { key, value, type: \"integer\" });\n\t}\n\treturn n * 1000;\n}\n\n/**\n * Coerces an env var to an integer and converts from minutes to milliseconds.\n * @param envVars The environment variables object.\n * @param key The property name of the env var to coerce.\n * @param defaultValue The value to return when the env var is absent. Omit to return undefined when absent.\n * @returns The value in milliseconds, the default, or undefined when absent and no default given.\n * @throws GeneralError if the value is set but cannot be coerced to an integer.\n */\nexport function envMinToMs<T>(envVars: T, key: keyof T, defaultValue: number): number;\nexport function envMinToMs<T>(envVars: T, key: keyof T): number | undefined;\nexport function envMinToMs<T>(envVars: T, key: keyof T, defaultValue?: number): number | undefined {\n\tconst value = envVars[key];\n\tif (!Is.stringValue(value)) {\n\t\treturn defaultValue;\n\t}\n\tconst n = Coerce.integer(value);\n\tif (Is.empty(n)) {\n\t\tthrow new GeneralError(\"node\", \"invalidEnvVarValue\", { key, value, type: \"integer\" });\n\t}\n\treturn n * 60_000;\n}\n\n/**\n * Converts a comma separated list to an array.\n * @param value The comma separated list.\n * @param defaultValue The default value to return when the list is empty or undefined.\n * @returns The array.\n */\nexport function commaSeparatedListToArray<U>(\n\tvalue: string | undefined,\n\tdefaultValue: U[] | undefined = []\n): U[] {\n\tif (!Is.stringValue(value)) {\n\t\treturn defaultValue;\n\t}\n\treturn value\n\t\t.split(\",\")\n\t\t.map(item => item.trim())\n\t\t.filter(item => item.length > 0) as U[];\n}\n\n/**\n * Gets named key integer pairs from an env var holding comma separated key=integer pairs.\n * @param envVars The environment variables object.\n * @param key The property name of the env var to read.\n * @returns The named key integer pairs, or undefined when the env var is absent or empty.\n * @throws GeneralError if an entry is not a unique name=value pair with an integer value.\n */\nexport function envKeyIntegerPairs<T>(\n\tenvVars: T,\n\tkey: keyof T\n): { [key: string]: number } | undefined {\n\tconst entries = commaSeparatedListToArray<string>(envVars[key] as string | undefined, undefined);\n\tif (!Is.arrayValue(entries)) {\n\t\treturn undefined;\n\t}\n\n\tconst keyValues: { [name: string]: number } = {};\n\tfor (const entry of entries) {\n\t\tconst parts = entry.split(\"=\").map(part => part.trim());\n\n\t\tconst keyPart = parts[0];\n\t\tconst valuePart = Coerce.integer(parts[1]);\n\t\tif (\n\t\t\tparts.length !== 2 ||\n\t\t\t!Is.stringValue(keyPart) ||\n\t\t\t!Is.integer(valuePart) ||\n\t\t\t!Is.undefined(keyValues[keyPart])\n\t\t) {\n\t\t\tthrow new GeneralError(\"node\", \"invalidEnvVarPair\", { key: keyPart, value: entry });\n\t\t}\n\t\tkeyValues[keyPart] = valuePart;\n\t}\n\n\treturn keyValues;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IEngineEnvironmentVariables.js","sourceRoot":"","sources":["../../../src/models/IEngineEnvironmentVariables.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The engine core environment variables.\n */\nexport interface IEngineEnvironmentVariables {\n\t/**\n\t * Start the engine in debug mode.\n\t */\n\tdebug?: string;\n\n\t/**\n\t * Start the engine in silent mode.\n\t */\n\tsilent?: string;\n\n\t/**\n\t * Controls how unrecognised TWIN_* environment variables are handled at startup.\n\t * \"error\" (default): throws a startup error, allowing CI and production deployments\n\t * to hard-fail on misconfigured or misspelled variable names.\n\t * \"warn\": logs a warning and continues.\n\t * \"ignore\": skips validation entirely.\n\t * Any other value is rejected at startup.\n\t * @default \"error\"\n\t */\n\tstrictEnv?: string;\n\n\t/**\n\t * Comma-separated list of raw environment variable names to exempt from the unknown-key check.\n\t * Use this to allowlist variables introduced by custom extensions that are not part of the\n\t * core interface, e.g. TWIN_MY_EXTENSION_SECRET.\n\t */\n\tenvAllowList?: string;\n\n\t/**\n\t * The root directory for storing items like state file.\n\t */\n\tstorageFileRoot?: string;\n\n\t/**\n\t * The name of the state file.\n\t */\n\tstateFilename?: string;\n\n\t/**\n\t * Is multi-tenant support enabled, defaults to false.\n\t */\n\ttenantEnabled?: string;\n\n\t/**\n\t * Enable schema migration, defaults to true.\n\t */\n\tschemaMigrationEnabled?: string;\n\n\t/**\n\t * The type of the entity storage to create, comma separate for more than one connector.\n\t * values: file, memory, aws-dynamodb, azure-cosmosdb, gcp-firestoredb, scylladb, mysql, mongodb, postgresql\n\t */\n\tentityStorageConnectorType?: string;\n\n\t/**\n\t * The default entity storage connector to use, defaults to the first one in the list.\n\t */\n\tentityStorageConnectorDefault?: string;\n\n\t/**\n\t * A prefix for all the table in entity-storage, can be empty.\n\t */\n\tentityStorageTablePrefix?: string;\n\n\t/**\n\t * AWS DynamoDB auth mode, either credentials or pod.\n\t */\n\tawsDynamodbAuthMode?: string;\n\n\t/**\n\t * AWS Dynamo DB access key id.\n\t */\n\tawsDynamodbAccessKeyId?: string;\n\n\t/**\n\t * AWS Dynamo DB Endpoint if running local instance.\n\t */\n\tawsDynamodbEndpoint?: string;\n\n\t/**\n\t * AWS Dynamo DB region.\n\t */\n\tawsDynamodbRegion?: string;\n\n\t/**\n\t * AWS Dynamo DB secret access key.\n\t */\n\tawsDynamodbSecretAccessKey?: string;\n\n\t/**\n\t * AWS Dynamo DB connection timeout in milliseconds.\n\t */\n\tawsDynamodbConnectionTimeout?: string;\n\n\t/**\n\t * Azure Cosmos DB key.\n\t */\n\tazureCosmosdbKey?: string;\n\n\t/**\n\t * Azure Cosmos DB container id.\n\t */\n\tazureCosmosdbContainerId?: string;\n\n\t/**\n\t * Azure Cosmos DB database id.\n\t */\n\tazureCosmosdbDatabaseId?: string;\n\n\t/**\n\t * Azure Cosmos DB endpoint.\n\t */\n\tazureCosmosdbEndpoint?: string;\n\n\t/**\n\t * GCP Firestore collection name.\n\t */\n\tgcpFirestoreCollectionName?: string;\n\n\t/**\n\t * GCP Firestore credentials.\n\t */\n\tgcpFirestoreCredentials?: string;\n\n\t/**\n\t * GCP Firestore database id.\n\t */\n\tgcpFirestoreDatabaseId?: string;\n\n\t/**\n\t * GCP Firestore endpoint.\n\t */\n\tgcpFirestoreEndpoint?: string;\n\n\t/**\n\t * GCP Firestore project id.\n\t */\n\tgcpFirestoreProjectId?: string;\n\n\t/**\n\t * ScyllaDB hosts as comma separated string.\n\t */\n\tscylladbHosts?: string;\n\n\t/**\n\t * ScyllaDB keyspace.\n\t */\n\tscylladbKeyspace?: string;\n\n\t/**\n\t * ScyllaDB local data center.\n\t */\n\tscylladbLocalDataCenter?: string;\n\n\t/**\n\t * ScyllaDB port.\n\t */\n\tscylladbPort?: string;\n\n\t/**\n\t * ScyllaDB connection pool: number of connections per local host.\n\t */\n\tscylladbPoolCoreConnectionsPerHost?: string;\n\n\t/**\n\t * ScyllaDB connection pool: maximum requests per connection.\n\t */\n\tscylladbPoolMaxRequestsPerConnection?: string;\n\n\t/**\n\t * MySQL host.\n\t */\n\tmySqlHost?: string;\n\n\t/**\n\t * MySQL port.\n\t */\n\tmySqlPort?: string;\n\n\t/**\n\t * MySQL username.\n\t */\n\tmySqlUser?: string;\n\n\t/**\n\t * MySQL password.\n\t */\n\tmySqlPassword?: string;\n\n\t/**\n\t * MySQL Database.\n\t */\n\tmySqlDatabase?: string;\n\n\t/**\n\t * MySQL connection pool: maximum number of connections.\n\t */\n\tmySqlPoolConnectionLimit?: string;\n\n\t/**\n\t * MySQL connection pool: maximum number of idle connections.\n\t */\n\tmySqlPoolMaxIdle?: string;\n\n\t/**\n\t * MySQL connection pool: milliseconds before an idle connection is removed.\n\t */\n\tmySqlPoolIdleTimeout?: string;\n\n\t/**\n\t * MySQL connection pool: enable TCP keep-alive.\n\t */\n\tmySqlPoolEnableKeepAlive?: string;\n\n\t/**\n\t * MySQL connection pool: wait for a connection when pool is full.\n\t */\n\tmySqlPoolWaitForConnections?: string;\n\n\t/**\n\t * MySQL connection pool: maximum queued requests (0 = unlimited).\n\t */\n\tmySqlPoolQueueLimit?: string;\n\n\t/**\n\t * MongoDB host.\n\t */\n\tmongoDbHost?: string;\n\n\t/**\n\t * MongoDB port.\n\t */\n\tmongoDbPort?: string;\n\n\t/**\n\t * MongoDB username.\n\t */\n\tmongoDbUser?: string;\n\n\t/**\n\t * MongoDB password.\n\t */\n\tmongoDbPassword?: string;\n\n\t/**\n\t * MongoDB Database.\n\t */\n\tmongoDbDatabase?: string;\n\n\t/**\n\t * MongoDB connection pool: maximum number of connections.\n\t */\n\tmongoDbPoolMaxPoolSize?: string;\n\n\t/**\n\t * MongoDB connection pool: minimum number of connections to maintain.\n\t */\n\tmongoDbPoolMinPoolSize?: string;\n\n\t/**\n\t * MongoDB connection pool: milliseconds a connection can remain idle before removal.\n\t */\n\tmongoDbPoolMaxIdleTime?: string;\n\n\t/**\n\t * MongoDB connection pool: milliseconds to wait for a connection before throwing.\n\t */\n\tmongoDbPoolWaitQueueTimeout?: string;\n\n\t/**\n\t * PostgreSQl host.\n\t */\n\tpostgreSqlHost?: string;\n\n\t/**\n\t * PostgreSQl port.\n\t */\n\tpostgreSqlPort?: string;\n\n\t/**\n\t * PostgreSQl username.\n\t */\n\tpostgreSqlUser?: string;\n\n\t/**\n\t * PostgreSQl password.\n\t */\n\tpostgreSqlPassword?: string;\n\n\t/**\n\t * PostgreSQl Database.\n\t */\n\tpostgreSqlDatabase?: string;\n\n\t/**\n\t * PostgreSQL connection pool: maximum number of connections.\n\t */\n\tpostgreSqlPoolMax?: string;\n\n\t/**\n\t * PostgreSQL connection pool: seconds a connection can remain idle before being closed.\n\t */\n\tpostgreSqlPoolIdleTimeout?: string;\n\n\t/**\n\t * PostgreSQL connection pool: seconds to wait when establishing a connection.\n\t */\n\tpostgreSqlPoolConnectTimeout?: string;\n\n\t/**\n\t * PostgreSQL connection pool: maximum seconds a connection can remain open.\n\t */\n\tpostgreSqlPoolMaxLifetime?: string;\n\n\t/**\n\t * The security token for accessing IPFS API.\n\t */\n\tipfsBearerToken?: string;\n\n\t/**\n\t * The url for accessing IPFS API.\n\t */\n\tipfsApiUrl?: string;\n\n\t/**\n\t * The type of the entity storage to create, comma separate for more than one connector.\n\t * values: memory, file, ipfs, aws-s3, azure-storage, gcp-storage.\n\t */\n\tblobStorageConnectorType?: string;\n\n\t/**\n\t * The default blob storage connector to use, defaults to the first one in the list.\n\t */\n\tblobStorageConnectorDefault?: string;\n\n\t/**\n\t * Enable encryption for the blob storage.\n\t */\n\tblobStorageEnableEncryption?: string;\n\n\t/**\n\t * The id of the encryption key for the blob storage.\n\t */\n\tblobStorageEncryptionKeyId?: string;\n\n\t/**\n\t * A prefix for all the blobs in blob-storage, can be empty.\n\t */\n\tblobStoragePrefix?: string;\n\n\t/**\n\t * AWS S3 region.\n\t */\n\tawsS3Region?: string;\n\n\t/**\n\t * AWS S3 bucket name.\n\t */\n\tawsS3BucketName?: string;\n\n\t/**\n\t * AWS S3 auth mode, either credentials or pod, defaults to credentials.\n\t */\n\tawsS3AuthMode?: string;\n\n\t/**\n\t * AWS S3 access key id.\n\t */\n\tawsS3AccessKeyId?: string;\n\n\t/**\n\t * AWS S3 secret access key.\n\t */\n\tawsS3SecretAccessKey?: string;\n\n\t/**\n\t * AWS S3 endpoint.\n\t */\n\tawsS3Endpoint?: string;\n\n\t/**\n\t * Azure Storage account key.\n\t */\n\tazureStorageAccountKey?: string;\n\n\t/**\n\t * Azure Storage account name.\n\t */\n\tazureStorageAccountName?: string;\n\n\t/**\n\t * Azure Storage container.\n\t */\n\tazureStorageContainerName?: string;\n\n\t/**\n\t * Azure Storage endpoint.\n\t */\n\tazureStorageEndpoint?: string;\n\n\t/**\n\t * GCP Storage bucket.\n\t */\n\tgcpStorageBucketName?: string;\n\n\t/**\n\t * GCP Storage credentials.\n\t */\n\tgcpStorageCredentials?: string;\n\n\t/**\n\t * GCP Storage endpoint.\n\t */\n\tgcpStorageEndpoint?: string;\n\n\t/**\n\t * GCP Storage project id.\n\t */\n\tgcpStorageProjectId?: string;\n\n\t/**\n\t * The type of the default vault connector: entity-storage, hashicorp.\n\t */\n\tvaultConnector?: string;\n\n\t/**\n\t * Prefix to prepend to entries in the vault.\n\t */\n\tvaultPrefix?: string;\n\n\t/**\n\t * Hashicorp Vault token.\n\t */\n\thashicorpVaultToken?: string;\n\n\t/**\n\t * Hashicorp Vault endpoint.\n\t */\n\thashicorpVaultEndpoint?: string;\n\n\t/**\n\t * The type of logging task connector, can be a comma separated list: console, entity-storage, open-telemetry, file.\n\t */\n\tloggingConnector?: string;\n\n\t/**\n\t * The batch size for the logging task, set to 1 for no batching.\n\t */\n\tloggingBatchSize?: string;\n\n\t/**\n\t * The batch flush interval in seconds for the logging task, how often to flush the logs when using batching, defaults to 5 seconds.\n\t */\n\tloggingBatchFlushInterval?: string;\n\n\t/**\n\t * Delete log entries older than this many minutes for the entity-storage logging connector.\n\t * Set to 0 to disable age-based retention.\n\t * @default 2880 (2 days)\n\t */\n\tloggingRetainFor?: string;\n\n\t/**\n\t * Keep at most this many log entries for the entity-storage logging connector.\n\t * Set to 0 to disable count-based retention.\n\t * @default 10000\n\t */\n\tloggingMaxEntries?: string;\n\n\t/**\n\t * How often the retention cleanup task runs in minutes for the entity-storage logging connector.\n\t * Set to 0 to disable periodic cleanup.\n\t * @default 5\n\t */\n\tloggingRetentionInterval?: string;\n\n\t/**\n\t * Maximum number of entries deleted per cleanup batch for the entity-storage logging connector.\n\t * Keeping this value smaller helps avoid spikes in database load.\n\t * @default 1000\n\t */\n\tloggingRetentionBatchSize?: string;\n\n\t/**\n\t * A list of components to exclude from logging, can be a comma separated list of component Class names e.g. \"ComponentA,ComponentB\".\n\t */\n\tloggingSilentComponents?: string;\n\n\t/**\n\t * The directory to write log files into when using the file logging connector. Required when TWIN_LOGGING_CONNECTOR includes \"file\".\n\t */\n\tloggingFileDirectory?: string;\n\n\t/**\n\t * The log filename when using the file logging connector, defaults to \"app.log\".\n\t */\n\tloggingFileFilename?: string;\n\n\t/**\n\t * The maximum log file size in bytes before rotation when using the file logging connector, defaults to 10485760 (10 MB). Set to 0 or negative to disable rotation.\n\t */\n\tloggingFileMaxFileSizeBytes?: string;\n\n\t/**\n\t * The number of rotated log files to retain when using the file logging connector, defaults to 5. Set to 0 or negative to keep all rotated files.\n\t */\n\tloggingFileMaxRetainedFiles?: string;\n\n\t/**\n\t * A list of components to exclude from telemetry, can be a comma separated list of component Class names e.g. \"ComponentA,ComponentB\".\n\t */\n\ttelemetrySilentComponents?: string;\n\n\t/**\n\t * The name of the OpenTelemetry logger, only required if using open-telemetry as logging connector, defaults to twin-logging.\n\t */\n\topenTelemetryLoggingLoggerName?: string;\n\n\t/**\n\t * The version of the OpenTelemetry logger, only required if using open-telemetry as logging connector, defaults to 1.0.0.\n\t */\n\topenTelemetryLoggingLoggerVersion?: string;\n\n\t/**\n\t * The OTLP endpoint URL for the OpenTelemetry logging exporter, required when using open-telemetry as logging connector, e.g. http://localhost:4318/v1/logs.\n\t */\n\topenTelemetryLoggingPrometheusEndpoint?: string;\n\n\t/**\n\t * The log record processor to use for the OpenTelemetry logging exporter, either batch or simple, defaults to batch.\n\t */\n\topenTelemetryLoggingProcessor?: string;\n\n\t/**\n\t * The type of event bus connector: local.\n\t */\n\teventBusConnector?: string;\n\n\t/**\n\t * The type of event bus component: service.\n\t */\n\teventBusComponent?: string;\n\n\t/**\n\t * Are the messaging components enabled, defaults to false.\n\t */\n\tmessagingEnabled?: string;\n\n\t/**\n\t * AWS SES region.\n\t */\n\tawsSesRegion?: string;\n\n\t/**\n\t * AWS SES auth mode, either credentials or pod, defaults to credentials.\n\t */\n\tawsSesAuthMode?: string;\n\n\t/**\n\t * AWS SES secret access key.\n\t */\n\tawsSesSecretAccessKey?: string;\n\n\t/**\n\t * AWS SES access key id.\n\t */\n\tawsSesAccessKeyId?: string;\n\n\t/**\n\t * AWS SES endpoint.\n\t */\n\tawsSesEndpoint?: string;\n\n\t/**\n\t * The applications for the push notifications reference a separate json with @json: prefix.\n\t */\n\tawsMessagingPushNotificationApplications?: string;\n\n\t/**\n\t * The type of messaging email connector: entity-storage, aws.\n\t */\n\tmessagingEmailConnector?: string;\n\n\t/**\n\t * The type of messaging sms connector: entity-storage, aws.\n\t */\n\tmessagingSmsConnector?: string;\n\n\t/**\n\t * The type of messaging push notification connector: entity-storage, aws.\n\t */\n\tmessagingPushNotificationConnector?: string;\n\n\t/**\n\t * The type of telemetry connector: entity-storage.\n\t */\n\ttelemetryConnector?: string;\n\n\t/**\n\t * The name of the Open Telemetry meter to use, only required if using open-telemetry as telemetry connector, defaults to twin-node.\n\t */\n\topenTelemetryMeterName?: string;\n\n\t/**\n\t * The version of the Open Telemetry metrics specification to use, only required if using open-telemetry as telemetry connector, defaults to 1.0.0.\n\t */\n\topenTelemetryMeterVersion?: string;\n\n\t/**\n\t * The type of Open Telemetry metric reader to use, only required if using open-telemetry as telemetry connector, values: prometheus.\n\t */\n\topenTelemetryReader?: string;\n\n\t/**\n\t * The port to use for the Open Telemetry Prometheus metrics server, only required if using open-telemetry as telemetry connector and prometheus as reader, defaults to 9464.\n\t */\n\topenTelemetryPrometheusPort?: string;\n\n\t/**\n\t * Polling interval in seconds for the telemetry metrics collector. Defaults to 60.\n\t */\n\ttelemetryMetricsCollectorInterval?: string;\n\n\t/**\n\t * The type of telemetry metrics producers, can be a comma separated list: system, process.\n\t */\n\ttelemetryMetricsProducers?: string;\n\n\t/**\n\t * Maximum number of values retained per telemetry metric (count-based history cap). Defaults to 1440.\n\t */\n\ttelemetryMetricsProducerMaxHistory?: string;\n\n\t/**\n\t * The batch size for the telemetry connector, set to 1 to disable size-based flushing.\n\t */\n\ttelemetryBatchSize?: string;\n\n\t/**\n\t * The batch flush interval in seconds for the telemetry connector, how often to flush when using batching, defaults to 5 seconds.\n\t */\n\ttelemetryBatchFlushInterval?: string;\n\n\t/**\n\t * The maximum number of metric values to hold in the write-ahead cache for the telemetry connector. Set to 0 for unlimited.\n\t * @default 1000\n\t */\n\ttelemetryMaxCacheSize?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the telemetry connector.\n\t */\n\ttelemetryMutexTimeout?: string;\n\n\t/**\n\t * A list of components to exclude from tracing, can be a comma separated list of component Class names e.g. \"ComponentA,ComponentB\".\n\t */\n\ttracingSilentComponents?: string;\n\n\t/**\n\t * The type of tracing connector: entity-storage, open-telemetry.\n\t */\n\ttracingConnector?: string;\n\n\t/**\n\t * The name of the Open Telemetry tracer to use, only required if using open-telemetry as tracing connector, defaults to twin-node.\n\t */\n\topenTelemetryTracingTracerName?: string;\n\n\t/**\n\t * The version of the Open Telemetry tracing specification to use, only required if using open-telemetry as tracing connector, defaults to 1.0.0.\n\t */\n\topenTelemetryTracingTracerVersion?: string;\n\n\t/**\n\t * The OTLP HTTP endpoint to push spans to, e.g. http://localhost:4318/v1/traces. Required when using open-telemetry as tracing connector.\n\t */\n\topenTelemetryTracingEndpoint?: string;\n\n\t/**\n\t * The span processor: batch (default) or simple. Only used when TWIN_TRACING_CONNECTOR=open-telemetry.\n\t */\n\topenTelemetryTracingProcessor?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the tracing connector.\n\t */\n\ttracingMutexTimeout?: string;\n\n\t/**\n\t * The type of faucet connector: entity-storage, iota.\n\t */\n\tfaucetConnector?: string;\n\n\t/**\n\t * The type of wallet connector: entity-storage, iota.\n\t */\n\twalletConnector?: string;\n\n\t/**\n\t * The type of NFT connector: entity-storage, iota.\n\t */\n\tnftConnector?: string;\n\n\t/**\n\t * The NFT deployed package id, for custom deployments.\n\t */\n\tnftPackageId?: string;\n\n\t/**\n\t * The type of notarization connector: entity-storage, iota.\n\t */\n\tnotarizationConnector?: string;\n\n\t/**\n\t * The type of identity connector: entity-storage, iota.\n\t */\n\tidentityConnector?: string;\n\n\t/**\n\t * The index of the wallet address to use, defaults to 0.\n\t */\n\tidentityWalletAddressIndex?: string;\n\n\t/**\n\t * The TTL in milliseconds for caching resolved DIDs when using the IOTA identity connector. Omit to use the connector default.\n\t */\n\tidentityDidResolutionCacheTtl?: string;\n\n\t/**\n\t * The maximum number of DID documents to hold in the resolution cache. Only used when using the IOTA identity connector and caching is enabled.\n\t */\n\tidentityDidResolutionCacheCapacity?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the DID resolution cache. Only used when using the IOTA identity connector and caching is enabled.\n\t */\n\tidentityDidResolutionCacheMutexTimeout?: string;\n\n\t/**\n\t * The number of times to retry resolving a DID after a write operation (create, update, or delete) to confirm propagation. Only used when using the IOTA identity connector.\n\t */\n\tidentityDidResolutionRetries?: string;\n\n\t/**\n\t * The delay in milliseconds between DID resolution retries after a write operation. Only used when using the IOTA identity connector.\n\t */\n\tidentityDidResolutionRetryDelay?: string;\n\n\t/**\n\t * The type of identity resolver connector: entity-storage, iota.\n\t */\n\tidentityResolverConnector?: string;\n\n\t/**\n\t * IOTA Faucet Endpoint.\n\t */\n\tiotaFaucetEndpoint?: string;\n\n\t/**\n\t * IOTA Node Endpoint.\n\t */\n\tiotaNodeEndpoint?: string;\n\n\t/**\n\t * IOTA network.\n\t */\n\tiotaNetwork?: string;\n\n\t/**\n\t * IOTA coin type.\n\t */\n\tiotaCoinType?: string;\n\n\t/**\n\t * IOTA gas budget, in nanos.\n\t */\n\tiotaGasBudget?: string;\n\n\t/**\n\t * IOTA gas reservation duration, in seconds.\n\t */\n\tiotaGasReservationDuration?: string;\n\n\t/**\n\t * IOTA Explorer Endpoint.\n\t */\n\tiotaExplorerEndpoint?: string;\n\n\t/**\n\t * IOTA Gas Station Endpoint.\n\t */\n\tiotaGasStationEndpoint?: string;\n\n\t/**\n\t * IOTA Gas Station Authentication Token.\n\t */\n\tiotaGasStationAuthToken?: string;\n\n\t/**\n\t * The IOTA Identity deployed package id, for custom deployments.\n\t */\n\tiotaIdentityPackageId?: string;\n\n\t/**\n\t * Universal Resolver Endpoint.\n\t */\n\tuniversalResolverEndpoint?: string;\n\n\t/**\n\t * The type of identity profile connector: entity-storage.\n\t */\n\tidentityProfileConnector?: string;\n\n\t/**\n\t * The identity verification method id to use with immutable proofs.\n\t */\n\timmutableProofVerificationMethodId?: string;\n\n\t/**\n\t * The number of times to retry a proof task when it fails, 0 to disable retries.\n\t * @default 5\n\t */\n\timmutableProofTaskRetryCount?: string;\n\n\t/**\n\t * The interval in seconds to wait between proof task retries.\n\t * @default 5\n\t */\n\timmutableProofTaskRetryInterval?: string;\n\n\t/**\n\t * The time in minutes to retain the record of a failed proof task.\n\t * Set to -1 to retain failures forever.\n\t * @default 10080\n\t */\n\timmutableProofTaskFailureRetainFor?: string;\n\n\t/**\n\t * How often in minutes the immutable proof reconciliation sweep runs.\n\t * @default 30\n\t */\n\timmutableProofSweepInterval?: string;\n\n\t/**\n\t * The minimum age in minutes before a proof with no notarization is considered stuck.\n\t * @default 180\n\t */\n\timmutableProofSweepStaleThreshold?: string;\n\n\t/**\n\t * The number of sweep attempts made before a proof is parked.\n\t * @default 5\n\t */\n\timmutableProofSweepMaxAttempts?: string;\n\n\t/**\n\t * The maximum number of proofs to re-enqueue per tenant per sweep cycle.\n\t * @default 10\n\t */\n\timmutableProofSweepBatchLimit?: string;\n\n\t/**\n\t * The minimum time in minutes between sweep attempts for the same proof.\n\t * @default 60\n\t */\n\timmutableProofSweepBackoff?: string;\n\n\t/**\n\t * ISO 8601 date-time used to treat older missing-task proofs as retryable.\n\t */\n\timmutableProofSweepAssumeRetryableBefore?: string;\n\n\t/**\n\t * The type of attestation connector: entity-storage, iota.\n\t */\n\tattestationConnector?: string;\n\n\t/**\n\t * The identity verification method id to use with attestation.\n\t */\n\tattestationVerificationMethodId?: string;\n\n\t/**\n\t * Is the data processing enabled, defaults to false.\n\t */\n\tdataProcessingEnabled?: string;\n\n\t/**\n\t * The type of the default data converters, can be a comma separated list: json, xml.\n\t */\n\tdataConverterConnectors?: string;\n\n\t/**\n\t * The type of the default data extractor, can be a comma separated list: json-path.\n\t */\n\tdataExtractorConnectors?: string;\n\n\t/**\n\t * Enable the task scheduler regardless of which other components are active, defaults to false.\n\t */\n\ttaskSchedulerEnabled?: string;\n\n\t/**\n\t * Is the auditable item graph enabled, defaults to false.\n\t */\n\tauditableItemGraphEnabled?: string;\n\n\t/**\n\t * Is the auditable item stream enabled, defaults to false.\n\t */\n\tauditableItemStreamEnabled?: string;\n\n\t/**\n\t * Is the document management enabled, defaults to false.\n\t */\n\tdocumentManagementEnabled?: string;\n\n\t/**\n\t * Enable the federated catalogue, defaults to false, automatically enabled if remote endpoint, filters or dataspace is enabled.\n\t */\n\tfederatedCatalogueEnabled?: string;\n\n\t/**\n\t * Federated catalog filters, command separated list of filters to add.\n\t */\n\tfederatedCatalogueFilters?: string;\n\n\t/**\n\t * Federated catalog remote endpoint, if set will use a REST client instead of local service.\n\t */\n\tfederatedCatalogueRemoteEndpoint?: string;\n\n\t/**\n\t * The path prefix used by the federated catalogue REST client when forwarding requests to the remote endpoint, defaults to \"federated-catalogue\".\n\t */\n\tfederatedCatalogueRestClientPathPrefix?: string;\n\n\t/**\n\t * The trust generators to add to the factory, comma separated list.\n\t */\n\ttrustGenerators?: string;\n\n\t/**\n\t * The trust verifiers to add to the factory, comma separated list.\n\t */\n\ttrustVerifiers?: string;\n\n\t/**\n\t * The verification method to use for trust identities.\n\t * Defaults to trust-assertion.\n\t */\n\ttrustVerificationMethodId?: string;\n\n\t/**\n\t * The trust time to live for generating JWTs in seconds.\n\t * Defaults to undefined for never expiring.\n\t */\n\ttrustJwtTtl?: string;\n\n\t/**\n\t * The allow lists for the trust identity verifier, comma separated list of identities.\n\t */\n\ttrustIdentitiesAllow?: string;\n\n\t/**\n\t * The deny lists for the trust identity verifier, comma separated list of identities.\n\t */\n\ttrustIdentitiesDeny?: string;\n\n\t/**\n\t * Path under which the rights management service is mounted (single source\n\t * of truth). The same value drives:\n\t * - the server route mount (via engine config)\n\t * - the PNP service's callback URL builder (`buildCallbackUrl`)\n\t * - the PNP rest-client's pathPrefix (consumer side)\n\t * Defaults to `rights-management`. Set when deploying behind a reverse proxy\n\t * with path rewriting, K8s ingress with path-based routing, or any custom\n\t * mount point.\n\t */\n\trightsManagementCallbackPath?: string;\n\n\t/**\n\t * The rights management policy information sources to add to the factory.\n\t */\n\trightsManagementPolicyInformationSources?: string;\n\n\t/**\n\t * The rights management policy negotiators sources to add to the factory.\n\t */\n\trightsManagementPolicyNegotiators?: string;\n\n\t/**\n\t * The rights management policy requesters to add to the factory.\n\t */\n\trightsManagementPolicyRequesters?: string;\n\n\t/**\n\t * The rights management policy execution actions to add to the factory.\n\t */\n\trightsManagementPolicyExecutionActions?: string;\n\n\t/**\n\t * The rights management policy enforcement processors to add to the factory.\n\t */\n\trightsManagementPolicyEnforcementProcessors?: string;\n\n\t/**\n\t * The rights management policy arbiters to add to the factory.\n\t */\n\trightsManagementPolicyArbiters?: string;\n\n\t/**\n\t * The rights management policy obligation enforcers to add to the factory.\n\t */\n\trightsManagementPolicyObligationEnforcers?: string;\n\n\t/**\n\t * Is the dataspace enabled, defaults to false.\n\t */\n\tdataspaceEnabled?: string;\n\n\t/**\n\t * The length of time to retain the activity logs for in seconds, set to -1 to keep forever.\n\t * @default 600\n\t */\n\tdataspaceRetainActivityLogsFor?: string;\n\n\t/**\n\t * The interval in seconds for cleaning up the activity logs.\n\t * @default 3600\n\t */\n\tdataspaceActivityLogsCleanupInterval?: string;\n\n\t/**\n\t * The TTL in milliseconds for the dataspace agreement cache.\n\t */\n\tdataspaceAgreementCacheTtl?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the dataspace agreement cache.\n\t */\n\tdataspaceAgreementCacheMutexTimeout?: string;\n\n\t/**\n\t * The time in milliseconds after which an unused agreement is eligible for removal.\n\t */\n\tdataspaceAgreementUnusedThreshold?: string;\n\n\t/**\n\t * The interval in milliseconds between agreement sweep runs.\n\t */\n\tdataspaceAgreementSweepInterval?: string;\n\n\t/**\n\t * The number of times to retry failed data plane tasks.\n\t */\n\tdataspaceRetryCount?: string;\n\n\t/**\n\t * Maximum HTTP retry attempts per push delivery task execution.\n\t */\n\tdataspacePushRetryCount?: string;\n\n\t/**\n\t * Base delay in milliseconds for exponential backoff between push HTTP retries.\n\t */\n\tdataspacePushRetryBaseDelay?: string;\n\n\t/**\n\t * Timeout in milliseconds for each push delivery HTTP POST request.\n\t */\n\tdataspacePushTimeout?: string;\n\n\t/**\n\t * Interval in milliseconds between orphaned push subscription cleanup scans.\n\t */\n\tdataspacePushSubscriptionCleanupInterval?: string;\n\n\t/**\n\t * Base route path for the data plane service (path only, not full URL).\n\t * Combined with the public origin to form the `dataAddress.endpoint` sent to PULL consumers\n\t * and the inbox URL sent to PUSH providers.\n\t *\n\t * This must be the mount-point prefix of the data plane routes, NOT a specific route path.\n\t * Do NOT append sub-paths such as `/entities` or `/inbox` - those are appended automatically\n\t * by each transfer handler and by the data plane REST client.\n\t *\n\t * REQUIRED if PULL or PUSH transfers are supported.\n\t * If not specified, PULL and PUSH transfers will not be available.\n\t *\n\t * Example: \"dataspace\"\n\t */\n\tdataspaceDataPlanePath?: string;\n\n\t/**\n\t * Whether the provider immediately starts a transfer once it has been requested.\n\t * When false the transfer stays in REQUESTED until the provider explicitly calls transferStarted.\n\t * @default false\n\t */\n\tdataspaceAutoStartTransfers?: string;\n\n\t/**\n\t * How long in seconds a negotiation may sit without progress before it is treated as timed out.\n\t * @default 30\n\t */\n\tdataspaceStalledNegotiationTimeout?: string;\n\n\t/**\n\t * How long in seconds a consumer-initiated transfer may sit in REQUESTED without the provider\n\t * progressing it before it is treated as timed out.\n\t * @default 30\n\t */\n\tdataspaceStalledTransferTimeout?: string;\n\n\t/**\n\t * How long in seconds a provider transfer may stay idle before the idle policy marks it as stalled.\n\t */\n\tdataspaceProviderTransferIdleTimeout?: string;\n\n\t/**\n\t * How frequently in seconds the provider idle transfer policy sweep runs.\n\t */\n\tdataspaceProviderTransferPolicySweepInterval?: string;\n\n\t/**\n\t * Path under which the dataspace control plane is mounted (path only, not full URL).\n\t * This must match the control-plane REST mount, as it is combined with the public\n\t * origin to build the consumer's advertised callback address.\n\t * @default \"dataspace-control-plane\"\n\t */\n\tdataspaceCallbackPath?: string;\n\n\t/**\n\t * Are the health components enabled, defaults to false.\n\t */\n\thealthEnabled?: string;\n\n\t/**\n\t * The interval in seconds for performing health checks, defaults to 60.\n\t */\n\thealthInterval?: string;\n\n\t/**\n\t * The interval in seconds for performing health checks at startup, defaults to 2.\n\t * This allows components that take a long time to initialize to be healthy before the first health check is performed.\n\t */\n\thealthStartupInterval?: string;\n\n\t/**\n\t * The interval in seconds for running the application health lifecycle (init, application, teardown), defaults to 300.\n\t */\n\thealthApplicationInterval?: string;\n\n\t/**\n\t * The type of the automation action to create, comma separate for more than one connector.\n\t * values: fetch\n\t */\n\tautomationActionTypes?: string;\n\n\t/**\n\t * The default mutex timeout in milliseconds, used when no component-specific timeout is set, defaults to 5000 if omitted.\n\t */\n\tmutexTimeoutDefault?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the auditable item graph component.\n\t */\n\tauditableItemGraphMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the auditable item stream component.\n\t */\n\tauditableItemStreamMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the federated catalogue component.\n\t */\n\tfederatedCatalogueMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the document management component.\n\t */\n\tdocumentManagementMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the logging component.\n\t */\n\tloggingMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the memory and file entity storage connectors.\n\t */\n\tentityStorageMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the rights management component.\n\t */\n\trightsManagementMutexTimeout?: string;\n\n\t/**\n\t * A comma separated list of additional node extensions to load, the initialiseExtension method will be called for each extension.\n\t */\n\textensions?: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IEngineEnvironmentVariables.js","sourceRoot":"","sources":["../../../src/models/IEngineEnvironmentVariables.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The engine core environment variables.\n */\nexport interface IEngineEnvironmentVariables {\n\t/**\n\t * Start the engine in debug mode.\n\t */\n\tdebug?: string;\n\n\t/**\n\t * Start the engine in silent mode.\n\t */\n\tsilent?: string;\n\n\t/**\n\t * Controls how unrecognised TWIN_* environment variables are handled at startup.\n\t * \"error\" (default): throws a startup error, allowing CI and production deployments\n\t * to hard-fail on misconfigured or misspelled variable names.\n\t * \"warn\": logs a warning and continues.\n\t * \"ignore\": skips validation entirely.\n\t * Any other value is rejected at startup.\n\t * @default \"error\"\n\t */\n\tstrictEnv?: string;\n\n\t/**\n\t * Comma-separated list of raw environment variable names to exempt from the unknown-key check.\n\t * Use this to allowlist variables introduced by custom extensions that are not part of the\n\t * core interface, e.g. TWIN_MY_EXTENSION_SECRET.\n\t */\n\tenvAllowList?: string;\n\n\t/**\n\t * The root directory for storing items like state file.\n\t */\n\tstorageFileRoot?: string;\n\n\t/**\n\t * The name of the state file.\n\t */\n\tstateFilename?: string;\n\n\t/**\n\t * Is multi-tenant support enabled, defaults to false.\n\t */\n\ttenantEnabled?: string;\n\n\t/**\n\t * Enable schema migration, defaults to true.\n\t */\n\tschemaMigrationEnabled?: string;\n\n\t/**\n\t * The type of the entity storage to create, comma separate for more than one connector.\n\t * values: file, memory, aws-dynamodb, azure-cosmosdb, gcp-firestoredb, scylladb, mysql, mongodb, postgresql\n\t */\n\tentityStorageConnectorType?: string;\n\n\t/**\n\t * The default entity storage connector to use, defaults to the first one in the list.\n\t */\n\tentityStorageConnectorDefault?: string;\n\n\t/**\n\t * A prefix for all the table in entity-storage, can be empty.\n\t */\n\tentityStorageTablePrefix?: string;\n\n\t/**\n\t * AWS DynamoDB auth mode, either credentials or pod.\n\t */\n\tawsDynamodbAuthMode?: string;\n\n\t/**\n\t * AWS Dynamo DB access key id.\n\t */\n\tawsDynamodbAccessKeyId?: string;\n\n\t/**\n\t * AWS Dynamo DB Endpoint if running local instance.\n\t */\n\tawsDynamodbEndpoint?: string;\n\n\t/**\n\t * AWS Dynamo DB region.\n\t */\n\tawsDynamodbRegion?: string;\n\n\t/**\n\t * AWS Dynamo DB secret access key.\n\t */\n\tawsDynamodbSecretAccessKey?: string;\n\n\t/**\n\t * AWS Dynamo DB connection timeout in milliseconds.\n\t */\n\tawsDynamodbConnectionTimeout?: string;\n\n\t/**\n\t * Azure Cosmos DB key.\n\t */\n\tazureCosmosdbKey?: string;\n\n\t/**\n\t * Azure Cosmos DB container id.\n\t */\n\tazureCosmosdbContainerId?: string;\n\n\t/**\n\t * Azure Cosmos DB database id.\n\t */\n\tazureCosmosdbDatabaseId?: string;\n\n\t/**\n\t * Azure Cosmos DB endpoint.\n\t */\n\tazureCosmosdbEndpoint?: string;\n\n\t/**\n\t * GCP Firestore collection name.\n\t */\n\tgcpFirestoreCollectionName?: string;\n\n\t/**\n\t * GCP Firestore credentials.\n\t */\n\tgcpFirestoreCredentials?: string;\n\n\t/**\n\t * GCP Firestore database id.\n\t */\n\tgcpFirestoreDatabaseId?: string;\n\n\t/**\n\t * GCP Firestore endpoint.\n\t */\n\tgcpFirestoreEndpoint?: string;\n\n\t/**\n\t * GCP Firestore project id.\n\t */\n\tgcpFirestoreProjectId?: string;\n\n\t/**\n\t * ScyllaDB hosts as comma separated string.\n\t */\n\tscylladbHosts?: string;\n\n\t/**\n\t * ScyllaDB keyspace.\n\t */\n\tscylladbKeyspace?: string;\n\n\t/**\n\t * ScyllaDB local data center.\n\t */\n\tscylladbLocalDataCenter?: string;\n\n\t/**\n\t * ScyllaDB port.\n\t */\n\tscylladbPort?: string;\n\n\t/**\n\t * ScyllaDB connection pool: number of connections per local host.\n\t */\n\tscylladbPoolCoreConnectionsPerHost?: string;\n\n\t/**\n\t * ScyllaDB connection pool: maximum requests per connection.\n\t */\n\tscylladbPoolMaxRequestsPerConnection?: string;\n\n\t/**\n\t * MySQL host.\n\t */\n\tmySqlHost?: string;\n\n\t/**\n\t * MySQL port.\n\t */\n\tmySqlPort?: string;\n\n\t/**\n\t * MySQL username.\n\t */\n\tmySqlUser?: string;\n\n\t/**\n\t * MySQL password.\n\t */\n\tmySqlPassword?: string;\n\n\t/**\n\t * MySQL Database.\n\t */\n\tmySqlDatabase?: string;\n\n\t/**\n\t * MySQL connection pool: maximum number of connections.\n\t */\n\tmySqlPoolConnectionLimit?: string;\n\n\t/**\n\t * MySQL connection pool: maximum number of idle connections.\n\t */\n\tmySqlPoolMaxIdle?: string;\n\n\t/**\n\t * MySQL connection pool: milliseconds before an idle connection is removed.\n\t */\n\tmySqlPoolIdleTimeout?: string;\n\n\t/**\n\t * MySQL connection pool: enable TCP keep-alive.\n\t */\n\tmySqlPoolEnableKeepAlive?: string;\n\n\t/**\n\t * MySQL connection pool: wait for a connection when pool is full.\n\t */\n\tmySqlPoolWaitForConnections?: string;\n\n\t/**\n\t * MySQL connection pool: maximum queued requests (0 = unlimited).\n\t */\n\tmySqlPoolQueueLimit?: string;\n\n\t/**\n\t * MongoDB host.\n\t */\n\tmongoDbHost?: string;\n\n\t/**\n\t * MongoDB port.\n\t */\n\tmongoDbPort?: string;\n\n\t/**\n\t * MongoDB username.\n\t */\n\tmongoDbUser?: string;\n\n\t/**\n\t * MongoDB password.\n\t */\n\tmongoDbPassword?: string;\n\n\t/**\n\t * MongoDB Database.\n\t */\n\tmongoDbDatabase?: string;\n\n\t/**\n\t * MongoDB connection pool: maximum number of connections.\n\t */\n\tmongoDbPoolMaxPoolSize?: string;\n\n\t/**\n\t * MongoDB connection pool: minimum number of connections to maintain.\n\t */\n\tmongoDbPoolMinPoolSize?: string;\n\n\t/**\n\t * MongoDB connection pool: milliseconds a connection can remain idle before removal.\n\t */\n\tmongoDbPoolMaxIdleTime?: string;\n\n\t/**\n\t * MongoDB connection pool: milliseconds to wait for a connection before throwing.\n\t */\n\tmongoDbPoolWaitQueueTimeout?: string;\n\n\t/**\n\t * PostgreSQl host.\n\t */\n\tpostgreSqlHost?: string;\n\n\t/**\n\t * PostgreSQl port.\n\t */\n\tpostgreSqlPort?: string;\n\n\t/**\n\t * PostgreSQl username.\n\t */\n\tpostgreSqlUser?: string;\n\n\t/**\n\t * PostgreSQl password.\n\t */\n\tpostgreSqlPassword?: string;\n\n\t/**\n\t * PostgreSQl Database.\n\t */\n\tpostgreSqlDatabase?: string;\n\n\t/**\n\t * PostgreSQL connection pool: maximum number of connections.\n\t */\n\tpostgreSqlPoolMax?: string;\n\n\t/**\n\t * PostgreSQL connection pool: seconds a connection can remain idle before being closed.\n\t */\n\tpostgreSqlPoolIdleTimeout?: string;\n\n\t/**\n\t * PostgreSQL connection pool: seconds to wait when establishing a connection.\n\t */\n\tpostgreSqlPoolConnectTimeout?: string;\n\n\t/**\n\t * PostgreSQL connection pool: maximum seconds a connection can remain open.\n\t */\n\tpostgreSqlPoolMaxLifetime?: string;\n\n\t/**\n\t * The security token for accessing IPFS API.\n\t */\n\tipfsBearerToken?: string;\n\n\t/**\n\t * The url for accessing IPFS API.\n\t */\n\tipfsApiUrl?: string;\n\n\t/**\n\t * The type of the entity storage to create, comma separate for more than one connector.\n\t * values: memory, file, ipfs, aws-s3, azure-storage, gcp-storage.\n\t */\n\tblobStorageConnectorType?: string;\n\n\t/**\n\t * The default blob storage connector to use, defaults to the first one in the list.\n\t */\n\tblobStorageConnectorDefault?: string;\n\n\t/**\n\t * Enable encryption for the blob storage.\n\t */\n\tblobStorageEnableEncryption?: string;\n\n\t/**\n\t * The id of the encryption key for the blob storage.\n\t */\n\tblobStorageEncryptionKeyId?: string;\n\n\t/**\n\t * A prefix for all the blobs in blob-storage, can be empty.\n\t */\n\tblobStoragePrefix?: string;\n\n\t/**\n\t * AWS S3 region.\n\t */\n\tawsS3Region?: string;\n\n\t/**\n\t * AWS S3 bucket name.\n\t */\n\tawsS3BucketName?: string;\n\n\t/**\n\t * AWS S3 auth mode, either credentials or pod, defaults to credentials.\n\t */\n\tawsS3AuthMode?: string;\n\n\t/**\n\t * AWS S3 access key id.\n\t */\n\tawsS3AccessKeyId?: string;\n\n\t/**\n\t * AWS S3 secret access key.\n\t */\n\tawsS3SecretAccessKey?: string;\n\n\t/**\n\t * AWS S3 endpoint.\n\t */\n\tawsS3Endpoint?: string;\n\n\t/**\n\t * Azure Storage account key.\n\t */\n\tazureStorageAccountKey?: string;\n\n\t/**\n\t * Azure Storage account name.\n\t */\n\tazureStorageAccountName?: string;\n\n\t/**\n\t * Azure Storage container.\n\t */\n\tazureStorageContainerName?: string;\n\n\t/**\n\t * Azure Storage endpoint.\n\t */\n\tazureStorageEndpoint?: string;\n\n\t/**\n\t * GCP Storage bucket.\n\t */\n\tgcpStorageBucketName?: string;\n\n\t/**\n\t * GCP Storage credentials.\n\t */\n\tgcpStorageCredentials?: string;\n\n\t/**\n\t * GCP Storage endpoint.\n\t */\n\tgcpStorageEndpoint?: string;\n\n\t/**\n\t * GCP Storage project id.\n\t */\n\tgcpStorageProjectId?: string;\n\n\t/**\n\t * The type of the default vault connector: entity-storage, hashicorp.\n\t */\n\tvaultConnector?: string;\n\n\t/**\n\t * Prefix to prepend to entries in the vault.\n\t */\n\tvaultPrefix?: string;\n\n\t/**\n\t * Hashicorp Vault token.\n\t */\n\thashicorpVaultToken?: string;\n\n\t/**\n\t * Hashicorp Vault endpoint.\n\t */\n\thashicorpVaultEndpoint?: string;\n\n\t/**\n\t * The type of logging task connector, can be a comma separated list: console, entity-storage, open-telemetry, file.\n\t */\n\tloggingConnector?: string;\n\n\t/**\n\t * The batch size for the logging task, set to 1 for no batching.\n\t */\n\tloggingBatchSize?: string;\n\n\t/**\n\t * The batch flush interval in seconds for the logging task, how often to flush the logs when using batching, defaults to 5 seconds.\n\t */\n\tloggingBatchFlushInterval?: string;\n\n\t/**\n\t * Delete log entries older than this many minutes for the entity-storage logging connector.\n\t * Set to 0 to disable age-based retention.\n\t * @default 2880 (2 days)\n\t */\n\tloggingRetainFor?: string;\n\n\t/**\n\t * Keep at most this many log entries for the entity-storage logging connector.\n\t * Set to 0 to disable count-based retention.\n\t * @default 10000\n\t */\n\tloggingMaxEntries?: string;\n\n\t/**\n\t * How often the retention cleanup task runs in minutes for the entity-storage logging connector.\n\t * Set to 0 to disable periodic cleanup.\n\t * @default 5\n\t */\n\tloggingRetentionInterval?: string;\n\n\t/**\n\t * Maximum number of entries deleted per cleanup batch for the entity-storage logging connector.\n\t * Keeping this value smaller helps avoid spikes in database load.\n\t * @default 1000\n\t */\n\tloggingRetentionBatchSize?: string;\n\n\t/**\n\t * A list of components to exclude from logging, can be a comma separated list of component Class names e.g. \"ComponentA,ComponentB\".\n\t */\n\tloggingSilentComponents?: string;\n\n\t/**\n\t * The directory to write log files into when using the file logging connector. Required when TWIN_LOGGING_CONNECTOR includes \"file\".\n\t */\n\tloggingFileDirectory?: string;\n\n\t/**\n\t * The log filename when using the file logging connector, defaults to \"app.log\".\n\t */\n\tloggingFileFilename?: string;\n\n\t/**\n\t * The maximum log file size in bytes before rotation when using the file logging connector, defaults to 10485760 (10 MB). Set to 0 or negative to disable rotation.\n\t */\n\tloggingFileMaxFileSizeBytes?: string;\n\n\t/**\n\t * The number of rotated log files to retain when using the file logging connector, defaults to 5. Set to 0 or negative to keep all rotated files.\n\t */\n\tloggingFileMaxRetainedFiles?: string;\n\n\t/**\n\t * A list of components to exclude from telemetry, can be a comma separated list of component Class names e.g. \"ComponentA,ComponentB\".\n\t */\n\ttelemetrySilentComponents?: string;\n\n\t/**\n\t * The name of the OpenTelemetry logger, only required if using open-telemetry as logging connector, defaults to twin-logging.\n\t */\n\topenTelemetryLoggingLoggerName?: string;\n\n\t/**\n\t * The version of the OpenTelemetry logger, only required if using open-telemetry as logging connector, defaults to 1.0.0.\n\t */\n\topenTelemetryLoggingLoggerVersion?: string;\n\n\t/**\n\t * The OTLP endpoint URL for the OpenTelemetry logging exporter, required when using open-telemetry as logging connector, e.g. http://localhost:4318/v1/logs.\n\t */\n\topenTelemetryLoggingPrometheusEndpoint?: string;\n\n\t/**\n\t * The log record processor to use for the OpenTelemetry logging exporter, either batch or simple, defaults to batch.\n\t */\n\topenTelemetryLoggingProcessor?: string;\n\n\t/**\n\t * The type of event bus connector: local.\n\t */\n\teventBusConnector?: string;\n\n\t/**\n\t * The type of event bus component: service.\n\t */\n\teventBusComponent?: string;\n\n\t/**\n\t * Are the messaging components enabled, defaults to false.\n\t */\n\tmessagingEnabled?: string;\n\n\t/**\n\t * AWS SES region.\n\t */\n\tawsSesRegion?: string;\n\n\t/**\n\t * AWS SES auth mode, either credentials or pod, defaults to credentials.\n\t */\n\tawsSesAuthMode?: string;\n\n\t/**\n\t * AWS SES secret access key.\n\t */\n\tawsSesSecretAccessKey?: string;\n\n\t/**\n\t * AWS SES access key id.\n\t */\n\tawsSesAccessKeyId?: string;\n\n\t/**\n\t * AWS SES endpoint.\n\t */\n\tawsSesEndpoint?: string;\n\n\t/**\n\t * The applications for the push notifications reference a separate json with @json: prefix.\n\t */\n\tawsMessagingPushNotificationApplications?: string;\n\n\t/**\n\t * The type of messaging email connector: entity-storage, aws.\n\t */\n\tmessagingEmailConnector?: string;\n\n\t/**\n\t * The type of messaging sms connector: entity-storage, aws.\n\t */\n\tmessagingSmsConnector?: string;\n\n\t/**\n\t * The type of messaging push notification connector: entity-storage, aws.\n\t */\n\tmessagingPushNotificationConnector?: string;\n\n\t/**\n\t * The type of telemetry connector, comma-separated for multiple: entity-storage, open-telemetry, silent.\n\t */\n\ttelemetryConnector?: string;\n\n\t/**\n\t * The name of the Open Telemetry meter to use, only required if using open-telemetry as telemetry connector, defaults to twin-node.\n\t */\n\topenTelemetryMeterName?: string;\n\n\t/**\n\t * The version of the Open Telemetry metrics specification to use, only required if using open-telemetry as telemetry connector, defaults to 1.0.0.\n\t */\n\topenTelemetryMeterVersion?: string;\n\n\t/**\n\t * The type of Open Telemetry metric reader to use, only required if using open-telemetry as telemetry connector, values: prometheus.\n\t */\n\topenTelemetryReader?: string;\n\n\t/**\n\t * The port to use for the Open Telemetry Prometheus metrics server, only required if using open-telemetry as telemetry connector and prometheus as reader, defaults to 9464.\n\t */\n\topenTelemetryPrometheusPort?: string;\n\n\t/**\n\t * Polling interval in seconds for the telemetry metrics collector. Defaults to 60.\n\t */\n\ttelemetryMetricsCollectorInterval?: string;\n\n\t/**\n\t * The type of telemetry metrics producers, can be a comma separated list: system, process.\n\t */\n\ttelemetryMetricsProducers?: string;\n\n\t/**\n\t * Maximum number of values retained per telemetry metric (count-based history cap). Defaults to 1440.\n\t */\n\ttelemetryMetricsProducerMaxHistory?: string;\n\n\t/**\n\t * The batch size for the telemetry connector, set to 1 to disable size-based flushing.\n\t */\n\ttelemetryBatchSize?: string;\n\n\t/**\n\t * The batch flush interval in seconds for the telemetry connector, how often to flush when using batching, defaults to 5 seconds.\n\t */\n\ttelemetryBatchFlushInterval?: string;\n\n\t/**\n\t * The maximum number of metric values to hold in the write-ahead cache for the telemetry connector. Set to 0 for unlimited.\n\t * @default 1000\n\t */\n\ttelemetryMaxCacheSize?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the telemetry connector.\n\t */\n\ttelemetryMutexTimeout?: string;\n\n\t/**\n\t * The maximum number of metric definitions held in the in-memory definition cache for the telemetry connector.\n\t * @default 100\n\t */\n\ttelemetryMetricDefinitionCacheCapacity?: string;\n\n\t/**\n\t * The time-to-idle in milliseconds for cached metric definitions in the telemetry connector.\n\t * @default 3600000\n\t */\n\ttelemetryMetricDefinitionCacheTtiMs?: string;\n\n\t/**\n\t * A list of components to exclude from tracing, can be a comma separated list of component Class names e.g. \"ComponentA,ComponentB\".\n\t */\n\ttracingSilentComponents?: string;\n\n\t/**\n\t * The type of tracing connector, comma-separated for multiple: entity-storage, open-telemetry, silent.\n\t */\n\ttracingConnector?: string;\n\n\t/**\n\t * The name of the Open Telemetry tracer to use, only required if using open-telemetry as tracing connector, defaults to twin-node.\n\t */\n\topenTelemetryTracingTracerName?: string;\n\n\t/**\n\t * The version of the Open Telemetry tracing specification to use, only required if using open-telemetry as tracing connector, defaults to 1.0.0.\n\t */\n\topenTelemetryTracingTracerVersion?: string;\n\n\t/**\n\t * The OTLP HTTP endpoint to push spans to, e.g. http://localhost:4318/v1/traces. Required when using open-telemetry as tracing connector.\n\t */\n\topenTelemetryTracingEndpoint?: string;\n\n\t/**\n\t * The span processor: batch (default) or simple. Only used when TWIN_TRACING_CONNECTOR=open-telemetry.\n\t */\n\topenTelemetryTracingProcessor?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the tracing connector.\n\t */\n\ttracingMutexTimeout?: string;\n\n\t/**\n\t * The type of faucet connector: entity-storage, iota.\n\t */\n\tfaucetConnector?: string;\n\n\t/**\n\t * The type of wallet connector: entity-storage, iota.\n\t */\n\twalletConnector?: string;\n\n\t/**\n\t * The type of NFT connector: entity-storage, iota.\n\t */\n\tnftConnector?: string;\n\n\t/**\n\t * The NFT deployed package id, for custom deployments.\n\t */\n\tnftPackageId?: string;\n\n\t/**\n\t * The type of notarization connector: entity-storage, iota.\n\t */\n\tnotarizationConnector?: string;\n\n\t/**\n\t * The type of identity connector: entity-storage, iota.\n\t */\n\tidentityConnector?: string;\n\n\t/**\n\t * The index of the wallet address to use, defaults to 0.\n\t */\n\tidentityWalletAddressIndex?: string;\n\n\t/**\n\t * The TTL in milliseconds for caching resolved DIDs when using the IOTA identity connector. Omit to use the connector default.\n\t */\n\tidentityDidResolutionCacheTtl?: string;\n\n\t/**\n\t * The maximum number of DID documents to hold in the resolution cache. Only used when using the IOTA identity connector and caching is enabled.\n\t */\n\tidentityDidResolutionCacheCapacity?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the DID resolution cache. Only used when using the IOTA identity connector and caching is enabled.\n\t */\n\tidentityDidResolutionCacheMutexTimeout?: string;\n\n\t/**\n\t * The number of times to retry resolving a DID after a write operation (create, update, or delete) to confirm propagation. Only used when using the IOTA identity connector.\n\t */\n\tidentityDidResolutionRetries?: string;\n\n\t/**\n\t * The delay in milliseconds between DID resolution retries after a write operation. Only used when using the IOTA identity connector.\n\t */\n\tidentityDidResolutionRetryDelay?: string;\n\n\t/**\n\t * The type of identity resolver connector: entity-storage, iota.\n\t */\n\tidentityResolverConnector?: string;\n\n\t/**\n\t * IOTA Faucet Endpoint.\n\t */\n\tiotaFaucetEndpoint?: string;\n\n\t/**\n\t * IOTA Node Endpoint.\n\t */\n\tiotaNodeEndpoint?: string;\n\n\t/**\n\t * IOTA network.\n\t */\n\tiotaNetwork?: string;\n\n\t/**\n\t * IOTA coin type.\n\t */\n\tiotaCoinType?: string;\n\n\t/**\n\t * IOTA gas budget, in nanos.\n\t */\n\tiotaGasBudget?: string;\n\n\t/**\n\t * IOTA gas reservation duration, in seconds.\n\t */\n\tiotaGasReservationDuration?: string;\n\n\t/**\n\t * IOTA Explorer Endpoint.\n\t */\n\tiotaExplorerEndpoint?: string;\n\n\t/**\n\t * IOTA Gas Station Endpoint.\n\t */\n\tiotaGasStationEndpoint?: string;\n\n\t/**\n\t * IOTA Gas Station Authentication Token.\n\t */\n\tiotaGasStationAuthToken?: string;\n\n\t/**\n\t * The IOTA Identity deployed package id, for custom deployments.\n\t */\n\tiotaIdentityPackageId?: string;\n\n\t/**\n\t * Universal Resolver Endpoint.\n\t */\n\tuniversalResolverEndpoint?: string;\n\n\t/**\n\t * The type of identity profile connector: entity-storage.\n\t */\n\tidentityProfileConnector?: string;\n\n\t/**\n\t * The identity verification method id to use with immutable proofs.\n\t */\n\timmutableProofVerificationMethodId?: string;\n\n\t/**\n\t * The number of times to retry a proof task when it fails, 0 to disable retries.\n\t * @default 5\n\t */\n\timmutableProofTaskRetryCount?: string;\n\n\t/**\n\t * The interval in seconds to wait between proof task retries.\n\t * @default 5\n\t */\n\timmutableProofTaskRetryInterval?: string;\n\n\t/**\n\t * The time in minutes to retain the record of a failed proof task.\n\t * Set to -1 to retain failures forever.\n\t * @default 10080\n\t */\n\timmutableProofTaskFailureRetainFor?: string;\n\n\t/**\n\t * How often in minutes the immutable proof reconciliation sweep runs.\n\t * @default 30\n\t */\n\timmutableProofSweepInterval?: string;\n\n\t/**\n\t * The minimum age in minutes before a proof with no notarization is considered stuck.\n\t * @default 180\n\t */\n\timmutableProofSweepStaleThreshold?: string;\n\n\t/**\n\t * The number of sweep attempts made before a proof is parked.\n\t * @default 5\n\t */\n\timmutableProofSweepMaxAttempts?: string;\n\n\t/**\n\t * The maximum number of proofs to re-enqueue per tenant per sweep cycle.\n\t * @default 10\n\t */\n\timmutableProofSweepBatchLimit?: string;\n\n\t/**\n\t * The minimum time in minutes between sweep attempts for the same proof.\n\t * @default 60\n\t */\n\timmutableProofSweepBackoff?: string;\n\n\t/**\n\t * ISO 8601 date-time used to treat older missing-task proofs as retryable.\n\t */\n\timmutableProofSweepAssumeRetryableBefore?: string;\n\n\t/**\n\t * The type of attestation connector: entity-storage, iota.\n\t */\n\tattestationConnector?: string;\n\n\t/**\n\t * The identity verification method id to use with attestation.\n\t */\n\tattestationVerificationMethodId?: string;\n\n\t/**\n\t * Is the data processing enabled, defaults to false.\n\t */\n\tdataProcessingEnabled?: string;\n\n\t/**\n\t * The type of the default data converters, can be a comma separated list: json, xml.\n\t */\n\tdataConverterConnectors?: string;\n\n\t/**\n\t * The type of the default data extractor, can be a comma separated list: json-path.\n\t */\n\tdataExtractorConnectors?: string;\n\n\t/**\n\t * Enable the task scheduler regardless of which other components are active, defaults to false.\n\t */\n\ttaskSchedulerEnabled?: string;\n\n\t/**\n\t * Is the auditable item graph enabled, defaults to false.\n\t */\n\tauditableItemGraphEnabled?: string;\n\n\t/**\n\t * Is the auditable item stream enabled, defaults to false.\n\t */\n\tauditableItemStreamEnabled?: string;\n\n\t/**\n\t * Is the document management enabled, defaults to false.\n\t */\n\tdocumentManagementEnabled?: string;\n\n\t/**\n\t * Enable the federated catalogue, defaults to false, automatically enabled if remote endpoint, filters or dataspace is enabled.\n\t */\n\tfederatedCatalogueEnabled?: string;\n\n\t/**\n\t * Federated catalog filters, command separated list of filters to add.\n\t */\n\tfederatedCatalogueFilters?: string;\n\n\t/**\n\t * Federated catalog remote endpoint, if set will use a REST client instead of local service.\n\t */\n\tfederatedCatalogueRemoteEndpoint?: string;\n\n\t/**\n\t * The path prefix used by the federated catalogue REST client when forwarding requests to the remote endpoint, defaults to \"federated-catalogue\".\n\t */\n\tfederatedCatalogueRestClientPathPrefix?: string;\n\n\t/**\n\t * The trust generators to add to the factory, comma separated list.\n\t */\n\ttrustGenerators?: string;\n\n\t/**\n\t * The trust verifiers to add to the factory, comma separated list.\n\t */\n\ttrustVerifiers?: string;\n\n\t/**\n\t * The verification method to use for trust identities.\n\t * Defaults to trust-assertion.\n\t */\n\ttrustVerificationMethodId?: string;\n\n\t/**\n\t * The trust time to live for generating JWTs in seconds.\n\t * Defaults to undefined for never expiring.\n\t */\n\ttrustJwtTtl?: string;\n\n\t/**\n\t * The allow lists for the trust identity verifier, comma separated list of identities.\n\t */\n\ttrustIdentitiesAllow?: string;\n\n\t/**\n\t * The deny lists for the trust identity verifier, comma separated list of identities.\n\t */\n\ttrustIdentitiesDeny?: string;\n\n\t/**\n\t * Path under which the rights management service is mounted (single source\n\t * of truth). The same value drives:\n\t * - the server route mount (via engine config)\n\t * - the PNP service's callback URL builder (`buildCallbackUrl`)\n\t * - the PNP rest-client's pathPrefix (consumer side)\n\t * Defaults to `rights-management`. Set when deploying behind a reverse proxy\n\t * with path rewriting, K8s ingress with path-based routing, or any custom\n\t * mount point.\n\t */\n\trightsManagementCallbackPath?: string;\n\n\t/**\n\t * The rights management policy information sources to add to the factory.\n\t */\n\trightsManagementPolicyInformationSources?: string;\n\n\t/**\n\t * The rights management policy negotiators sources to add to the factory.\n\t */\n\trightsManagementPolicyNegotiators?: string;\n\n\t/**\n\t * The rights management policy requesters to add to the factory.\n\t */\n\trightsManagementPolicyRequesters?: string;\n\n\t/**\n\t * The rights management policy execution actions to add to the factory.\n\t */\n\trightsManagementPolicyExecutionActions?: string;\n\n\t/**\n\t * The rights management policy enforcement processors to add to the factory.\n\t */\n\trightsManagementPolicyEnforcementProcessors?: string;\n\n\t/**\n\t * The rights management policy arbiters to add to the factory.\n\t */\n\trightsManagementPolicyArbiters?: string;\n\n\t/**\n\t * The rights management policy obligation enforcers to add to the factory.\n\t */\n\trightsManagementPolicyObligationEnforcers?: string;\n\n\t/**\n\t * Is the dataspace enabled, defaults to false.\n\t */\n\tdataspaceEnabled?: string;\n\n\t/**\n\t * The length of time to retain the activity logs for in seconds, set to -1 to keep forever.\n\t * @default 600\n\t */\n\tdataspaceRetainActivityLogsFor?: string;\n\n\t/**\n\t * The interval in seconds for cleaning up the activity logs.\n\t * @default 3600\n\t */\n\tdataspaceActivityLogsCleanupInterval?: string;\n\n\t/**\n\t * The TTL in milliseconds for the dataspace agreement cache.\n\t */\n\tdataspaceAgreementCacheTtl?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the dataspace agreement cache.\n\t */\n\tdataspaceAgreementCacheMutexTimeout?: string;\n\n\t/**\n\t * The time in milliseconds after which an unused agreement is eligible for removal.\n\t */\n\tdataspaceAgreementUnusedThreshold?: string;\n\n\t/**\n\t * The interval in milliseconds between agreement sweep runs.\n\t */\n\tdataspaceAgreementSweepInterval?: string;\n\n\t/**\n\t * The number of times to retry failed data plane tasks.\n\t */\n\tdataspaceRetryCount?: string;\n\n\t/**\n\t * Maximum HTTP retry attempts per push delivery task execution.\n\t */\n\tdataspacePushRetryCount?: string;\n\n\t/**\n\t * Base delay in milliseconds for exponential backoff between push HTTP retries.\n\t */\n\tdataspacePushRetryBaseDelay?: string;\n\n\t/**\n\t * Timeout in milliseconds for each push delivery HTTP POST request.\n\t */\n\tdataspacePushTimeout?: string;\n\n\t/**\n\t * Interval in milliseconds between orphaned push subscription cleanup scans.\n\t */\n\tdataspacePushSubscriptionCleanupInterval?: string;\n\n\t/**\n\t * Base route path for the data plane service (path only, not full URL).\n\t * Combined with the public origin to form the `dataAddress.endpoint` sent to PULL consumers\n\t * and the inbox URL sent to PUSH providers.\n\t *\n\t * This must be the mount-point prefix of the data plane routes, NOT a specific route path.\n\t * Do NOT append sub-paths such as `/entities` or `/inbox` - those are appended automatically\n\t * by each transfer handler and by the data plane REST client.\n\t *\n\t * REQUIRED if PULL or PUSH transfers are supported.\n\t * If not specified, PULL and PUSH transfers will not be available.\n\t *\n\t * Example: \"dataspace\"\n\t */\n\tdataspaceDataPlanePath?: string;\n\n\t/**\n\t * Whether the provider immediately starts a transfer once it has been requested.\n\t * When false the transfer stays in REQUESTED until the provider explicitly calls transferStarted.\n\t * @default false\n\t */\n\tdataspaceAutoStartTransfers?: string;\n\n\t/**\n\t * How long in seconds a negotiation may sit without progress before it is treated as timed out.\n\t * @default 30\n\t */\n\tdataspaceStalledNegotiationTimeout?: string;\n\n\t/**\n\t * How long in seconds a consumer-initiated transfer may sit in REQUESTED without the provider\n\t * progressing it before it is treated as timed out.\n\t * @default 30\n\t */\n\tdataspaceStalledTransferTimeout?: string;\n\n\t/**\n\t * How long in seconds a provider transfer may stay idle before the idle policy marks it as stalled.\n\t */\n\tdataspaceProviderTransferIdleTimeout?: string;\n\n\t/**\n\t * How frequently in seconds the provider idle transfer policy sweep runs.\n\t */\n\tdataspaceProviderTransferPolicySweepInterval?: string;\n\n\t/**\n\t * Path under which the dataspace control plane is mounted (path only, not full URL).\n\t * This must match the control-plane REST mount, as it is combined with the public\n\t * origin to build the consumer's advertised callback address.\n\t * @default \"dataspace-control-plane\"\n\t */\n\tdataspaceCallbackPath?: string;\n\n\t/**\n\t * Are the health components enabled, defaults to false.\n\t */\n\thealthEnabled?: string;\n\n\t/**\n\t * The interval in seconds for performing health checks, defaults to 60.\n\t */\n\thealthInterval?: string;\n\n\t/**\n\t * The interval in seconds for performing health checks at startup, defaults to 2.\n\t * This allows components that take a long time to initialize to be healthy before the first health check is performed.\n\t */\n\thealthStartupInterval?: string;\n\n\t/**\n\t * The interval in seconds for running the application health lifecycle (init, application, teardown), defaults to 300.\n\t */\n\thealthApplicationInterval?: string;\n\n\t/**\n\t * The type of the automation action to create, comma separate for more than one connector.\n\t * values: fetch\n\t */\n\tautomationActionTypes?: string;\n\n\t/**\n\t * The default mutex timeout in milliseconds, used when no component-specific timeout is set, defaults to 5000 if omitted.\n\t */\n\tmutexTimeoutDefault?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the auditable item graph component.\n\t */\n\tauditableItemGraphMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the auditable item stream component.\n\t */\n\tauditableItemStreamMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the federated catalogue component.\n\t */\n\tfederatedCatalogueMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the document management component.\n\t */\n\tdocumentManagementMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the logging component.\n\t */\n\tloggingMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the memory and file entity storage connectors.\n\t */\n\tentityStorageMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the rights management component.\n\t */\n\trightsManagementMutexTimeout?: string;\n\n\t/**\n\t * A comma separated list of additional node extensions to load, the initialiseExtension method will be called for each extension.\n\t */\n\textensions?: string;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IEngineServerEnvironmentVariables.js","sourceRoot":"","sources":["../../../src/models/IEngineServerEnvironmentVariables.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The engine server environment variables.\n */\nexport interface IEngineServerEnvironmentVariables {\n\t/**\n\t * The port to serve the API from.\n\t */\n\tport?: string;\n\n\t/**\n\t * The host to serve the API from.\n\t */\n\thost?: string;\n\n\t/**\n\t * The CORS origins to allow, defaults to *.\n\t */\n\tcorsOrigins?: string;\n\n\t/**\n\t * The CORS methods to allow, defaults to GET, POST, PUT, DELETE, OPTIONS.\n\t */\n\thttpMethods?: string;\n\n\t/**\n\t * The CORS headers to allow.\n\t */\n\thttpAllowedHeaders?: string;\n\n\t/**\n\t * The CORS headers to expose.\n\t */\n\thttpExposedHeaders?: string;\n\n\t/**\n\t * The public origin URL for the API e.g. https://api.example.com:1234\n\t */\n\tpublicOrigin?: string;\n\n\t/**\n\t * The type of auth admin processor to use on the API: entity-storage.\n\t */\n\tauthAdminProcessorType?: string;\n\n\t/**\n\t * The type of auth processor to use on the API: entity-storage.\n\t */\n\tauthProcessorType?: string;\n\n\t/**\n\t * The id of the key in the vault to use for signing in auth operations.\n\t */\n\tauthSigningKeyId?: string;\n\n\t/**\n\t * The HTTP header name used to pass the API key on requests, defaults to x-api-key.\n\t */\n\tauthApiKeyHeader?: string;\n\n\t/**\n\t * Additional MIME type processors to include, comma separated.\n\t */\n\tmimeTypeProcessors?: string;\n\n\t/**\n\t * Include the body in the REST logging output, useful for debugging.\n\t */\n\trouteLoggingIncludeBody?: string;\n\n\t/**\n\t * Include the full base 64 output in the REST logging output, useful for debugging.\n\t */\n\trouteLoggingFullBase64?: string;\n\n\t/**\n\t * List of properties to obfuscate in the REST logging output, comma separated.\n\t */\n\trouteLoggingObfuscateProperties?: string;\n\n\t/**\n\t * Comma-separated list of URL path prefixes excluded from metrics collection.\n\t */\n\trouteMetricsExcludePaths?: string;\n\n\t/**\n\t * Comma-separated list of URL path prefixes excluded from tracing.\n\t */\n\trouteTracingExcludePaths?: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IEngineServerEnvironmentVariables.js","sourceRoot":"","sources":["../../../src/models/IEngineServerEnvironmentVariables.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The engine server environment variables.\n */\nexport interface IEngineServerEnvironmentVariables {\n\t/**\n\t * The port to serve the API from.\n\t */\n\tport?: string;\n\n\t/**\n\t * The host to serve the API from.\n\t */\n\thost?: string;\n\n\t/**\n\t * The CORS origins to allow, defaults to *.\n\t */\n\tcorsOrigins?: string;\n\n\t/**\n\t * The CORS methods to allow, defaults to GET, POST, PUT, DELETE, OPTIONS.\n\t */\n\thttpMethods?: string;\n\n\t/**\n\t * The CORS headers to allow.\n\t */\n\thttpAllowedHeaders?: string;\n\n\t/**\n\t * The CORS headers to expose.\n\t */\n\thttpExposedHeaders?: string;\n\n\t/**\n\t * Named request body limits in bytes as comma separated name=bytes pairs, e.g. default=2097152,large=26214400.\n\t */\n\thttpBodyLimits?: string;\n\n\t/**\n\t * The public origin URL for the API e.g. https://api.example.com:1234\n\t */\n\tpublicOrigin?: string;\n\n\t/**\n\t * The type of auth admin processor to use on the API: entity-storage.\n\t */\n\tauthAdminProcessorType?: string;\n\n\t/**\n\t * The type of auth processor to use on the API: entity-storage.\n\t */\n\tauthProcessorType?: string;\n\n\t/**\n\t * The id of the key in the vault to use for signing in auth operations.\n\t */\n\tauthSigningKeyId?: string;\n\n\t/**\n\t * The HTTP header name used to pass the API key on requests, defaults to x-api-key.\n\t */\n\tauthApiKeyHeader?: string;\n\n\t/**\n\t * Additional MIME type processors to include, comma separated.\n\t */\n\tmimeTypeProcessors?: string;\n\n\t/**\n\t * Include the body in the REST logging output, useful for debugging.\n\t */\n\trouteLoggingIncludeBody?: string;\n\n\t/**\n\t * Include the full base 64 output in the REST logging output, useful for debugging.\n\t */\n\trouteLoggingFullBase64?: string;\n\n\t/**\n\t * List of properties to obfuscate in the REST logging output, comma separated.\n\t */\n\trouteLoggingObfuscateProperties?: string;\n\n\t/**\n\t * Comma-separated list of URL path prefixes excluded from metrics collection.\n\t */\n\trouteMetricsExcludePaths?: string;\n\n\t/**\n\t * Comma-separated list of URL path prefixes excluded from tracing.\n\t */\n\trouteTracingExcludePaths?: string;\n}\n"]}
|
|
@@ -153,6 +153,8 @@ const engineEnvironmentVariableKeysInternal = {
|
|
|
153
153
|
telemetryBatchFlushInterval: true,
|
|
154
154
|
telemetryMaxCacheSize: true,
|
|
155
155
|
telemetryMutexTimeout: true,
|
|
156
|
+
telemetryMetricDefinitionCacheCapacity: true,
|
|
157
|
+
telemetryMetricDefinitionCacheTtiMs: true,
|
|
156
158
|
telemetrySilentComponents: true,
|
|
157
159
|
// tracing
|
|
158
160
|
tracingConnector: true,
|