@twin.org/node-core 0.9.4 → 0.9.5-next.2
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 +554 -378
- package/dist/es/builders/engineEnvBuilder.js.map +1 -1
- package/dist/es/builders/engineServerEnvBuilder.js +5 -2
- package/dist/es/builders/engineServerEnvBuilder.js.map +1 -1
- package/dist/es/builders/helper/envHelpers.js +40 -9
- package/dist/es/builders/helper/envHelpers.js.map +1 -1
- package/dist/es/cli.js +1 -1
- package/dist/es/cli.js.map +1 -1
- package/dist/es/commands/bootstrapDev.js +3 -3
- package/dist/es/commands/bootstrapDev.js.map +1 -1
- package/dist/es/commands/help.js +1 -1
- package/dist/es/commands/help.js.map +1 -1
- package/dist/es/commands/identityCreate.js +2 -2
- package/dist/es/commands/identityCreate.js.map +1 -1
- package/dist/es/commands/identityVerificationMethodCreate.js +2 -2
- package/dist/es/commands/identityVerificationMethodCreate.js.map +1 -1
- package/dist/es/commands/userCreate.js +1 -1
- package/dist/es/commands/userCreate.js.map +1 -1
- package/dist/es/commands/vaultKeyCreate.js +1 -1
- package/dist/es/commands/vaultKeyCreate.js.map +1 -1
- package/dist/es/commands/vaultKeyImport.js +1 -1
- package/dist/es/commands/vaultKeyImport.js.map +1 -1
- package/dist/es/defaults.js +51 -0
- package/dist/es/defaults.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/deprecatedEnvironmentVariableKeys.js +16 -0
- package/dist/es/models/deprecatedEnvironmentVariableKeys.js.map +1 -0
- package/dist/es/models/engineEnvironmentVariableKeys.js +26 -5
- 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 +40 -21
- package/dist/es/node.js.map +1 -1
- package/dist/types/builders/engineEnvBuilder.d.ts +7 -0
- package/dist/types/builders/helper/envHelpers.d.ts +59 -2
- package/dist/types/defaults.d.ts +27 -0
- package/dist/types/models/IEngineEnvironmentVariables.d.ts +115 -18
- package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +4 -0
- package/dist/types/models/deprecatedEnvironmentVariableKeys.d.ts +7 -0
- package/docs/changelog.md +169 -0
- package/docs/reference/functions/isMailboxEnabled.md +20 -0
- package/docs/reference/index.md +6 -0
- package/docs/reference/interfaces/IEngineEnvironmentVariables.md +221 -32
- package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +8 -0
- package/docs/reference/variables/COMPONENT_FACTORY_TYPE_NAME.md +5 -0
- package/docs/reference/variables/DEFAULT_HEALTH_EXCLUDE_CLONE_COMPONENTS.md +9 -0
- package/docs/reference/variables/DEFAULT_TRACING_FACADE_COMPONENT_EXCLUDE_TYPES.md +8 -0
- package/docs/reference/variables/DEFAULT_TRACING_FACADE_FACTORIES.md +5 -0
- package/docs/reference/variables/TRACING_FACADE_NAME.md +5 -0
- package/locales/en.json +3 -1
- package/package.json +35 -34
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
// Copyright 2024 IOTA Stiftung.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { cpus } from "node:os";
|
|
3
4
|
import path from "node:path";
|
|
4
5
|
import { Is, Mutex } from "@twin.org/core";
|
|
5
6
|
import { EngineCloneMode } from "@twin.org/engine-models";
|
|
6
|
-
import { AttestationComponentType, AttestationConnectorType, AuditableItemGraphComponentType, AuditableItemStreamComponentType, AutomationComponentType, BackgroundTaskComponentType, BlobStorageComponentType, BlobStorageConnectorType, ContextIdHandlerComponentType, DataProcessingComponentType, DataspaceControlPlaneComponentType, DataspaceDataPlaneComponentType, DltConfigType, DocumentManagementComponentType, EngineTypeHelper, EntityStorageConnectorType, EventBusComponentType, EventBusConnectorType, FaucetConnectorType, FederatedCatalogueComponentType, HealthComponentType, IdentityComponentType, IdentityConnectorType, IdentityProfileComponentType, IdentityProfileConnectorType, IdentityResolverComponentType, IdentityResolverConnectorType, ImmutableProofComponentType, LoggingComponentType, LoggingConnectorType, MessagingAdminComponentType, MessagingComponentType, MessagingEmailConnectorType, MessagingPushNotificationConnectorType, MessagingSmsConnectorType, MetricsCollectorComponentType, MetricsProducerComponentType, NftComponentType, NftConnectorType, NotarizationComponentType, NotarizationConnectorType, PlatformComponentType, RightsManagementPapComponentType, RightsManagementPdpComponentType, RightsManagementPepComponentType, RightsManagementPipComponentType, RightsManagementPmpComponentType, RightsManagementPnapComponentType, RightsManagementPnpComponentType, RightsManagementPxpComponentType, SchemaVersionMigrationComponentType, TaskSchedulerComponentType, TelemetryComponentType, TelemetryConnectorType, TenantAdminComponentType, TracingComponentType, TracingConnectorType, TrustComponentType, TrustVerifierComponentType, VaultConnectorType, WalletConnectorType } from "@twin.org/engine-types";
|
|
7
|
+
import { AttestationComponentType, AttestationConnectorType, AuditableItemGraphComponentType, AuditableItemStreamComponentType, AutomationActionType, AutomationComponentType, BackgroundTaskComponentType, BlobStorageComponentType, BlobStorageConnectorType, ContextIdHandlerComponentType, DataConverterConnectorType, DataExtractorConnectorType, DataProcessingComponentType, DataspaceControlPlaneComponentType, DataspaceDataPlaneComponentType, DltConfigType, DocumentManagementComponentType, EmailProtocolConnectorType, EngineTypeHelper, EntityStorageConnectorType, EventBusComponentType, EventBusConnectorType, FacadeType, FaucetConnectorType, FederatedCatalogueComponentType, FederatedCatalogueFilterComponentType, HealthComponentType, IdentityComponentType, IdentityConnectorType, IdentityProfileComponentType, IdentityProfileConnectorType, IdentityResolverComponentType, IdentityResolverConnectorType, ImmutableProofComponentType, LoggingComponentType, LoggingConnectorType, MailboxComponentType, MailStorageComponentType, MessagingAdminComponentType, MessagingComponentType, MessagingEmailConnectorType, MessagingPushNotificationConnectorType, MessagingSmsConnectorType, MetricsCollectorComponentType, MetricsProducerComponentType, NftComponentType, NftConnectorType, NotarizationComponentType, NotarizationConnectorType, PlatformComponentType, RightsManagementPapComponentType, RightsManagementPdpComponentType, RightsManagementPepComponentType, RightsManagementPipComponentType, RightsManagementPmpComponentType, RightsManagementPnapComponentType, RightsManagementPnpComponentType, RightsManagementPolicyArbiterComponentType, RightsManagementPolicyEnforcementProcessorComponentType, RightsManagementPolicyExecutionActionComponentType, RightsManagementPolicyInformationSourceComponentType, RightsManagementPolicyNegotiatorComponentType, RightsManagementPolicyObligationEnforcerComponentType, RightsManagementPolicyRequesterComponentType, RightsManagementPxpComponentType, SchemaVersionMigrationComponentType, TaskSchedulerComponentType, TelemetryComponentType, TelemetryConnectorType, TenantAdminComponentType, TracingComponentType, TracingConnectorType, TrustComponentType, TrustGeneratorComponentType, TrustVerifierComponentType, VaultConnectorType, WalletConnectorType } from "@twin.org/engine-types";
|
|
7
8
|
import { OpenTelemetryExporterTypes } from "@twin.org/logging-connector-opentelemetry";
|
|
8
9
|
import { OpenTelemetryReaderTypes } from "@twin.org/telemetry-connector-opentelemetry";
|
|
9
10
|
import { OpenTelemetryProcessorTypes } from "@twin.org/tracing-connector-opentelemetry";
|
|
10
|
-
import {
|
|
11
|
+
import { TracingFacade } from "@twin.org/tracing-facades";
|
|
12
|
+
import { CONTEXT_ID_HANDLER_FEATURE_DID, CONTEXT_ID_HANDLER_FEATURE_TENANT, COMPONENT_FACTORY_TYPE_NAME, DEFAULT_HEALTH_EXCLUDE_CLONE_COMPONENTS, DEFAULT_TRACING_FACADE_COMPONENT_EXCLUDE_TYPES, DEFAULT_TRACING_FACADE_FACTORIES, TRACING_FACADE_NAME } from "../defaults.js";
|
|
11
13
|
import { isAuthEntityStorageRequired } from "./engineServerEnvBuilder.js";
|
|
12
|
-
import { commaSeparatedListToArray, envArray, envBoolean, envCount, envDateTime, envInteger, envMinToMs, envMinutes, envMs, envSecToMs, envSeconds } from "./helper/envHelpers.js";
|
|
14
|
+
import { commaSeparatedListToArray, envArray, envBoolean, envChoice, envCount, envDateTime, envInteger, envListToArray, envMinToMs, envMinutes, envMs, envSecToMs, envSeconds } from "./helper/envHelpers.js";
|
|
13
15
|
/**
|
|
14
16
|
* Build the engine core configuration from environment variables.
|
|
15
17
|
* @param envVars The environment variables.
|
|
@@ -32,7 +34,7 @@ export async function buildEngineConfiguration(envVars) {
|
|
|
32
34
|
types: {}
|
|
33
35
|
};
|
|
34
36
|
const mutexTimeoutMs = envMs(envVars, "mutexTimeoutDefault");
|
|
35
|
-
if (
|
|
37
|
+
if (Is.notEmpty(mutexTimeoutMs)) {
|
|
36
38
|
Mutex.setDefaultTimeoutMs(mutexTimeoutMs);
|
|
37
39
|
}
|
|
38
40
|
await configureSchemaMigration(coreConfig, envVars);
|
|
@@ -50,7 +52,9 @@ export async function buildEngineConfiguration(envVars) {
|
|
|
50
52
|
await configureTelemetry(coreConfig, envVars);
|
|
51
53
|
await configureMetricsCollector(coreConfig, envVars);
|
|
52
54
|
await configureTracing(coreConfig, envVars);
|
|
55
|
+
await configureFacades(coreConfig, envVars);
|
|
53
56
|
await configureMessaging(coreConfig, envVars);
|
|
57
|
+
await configureMailbox(coreConfig, envVars);
|
|
54
58
|
await configureAutomation(coreConfig, envVars);
|
|
55
59
|
await configureHealth(coreConfig, envVars);
|
|
56
60
|
await configureFaucet(coreConfig, envVars);
|
|
@@ -81,163 +85,165 @@ export async function buildEngineConfiguration(envVars) {
|
|
|
81
85
|
async function configureEntityStorage(coreConfig, envVars) {
|
|
82
86
|
coreConfig.types ??= {};
|
|
83
87
|
coreConfig.types.entityStorageConnector ??= [];
|
|
84
|
-
const entityStorageConnectorTypes =
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.File)) {
|
|
96
|
-
coreConfig.types.entityStorageConnector.push({
|
|
97
|
-
type: EntityStorageConnectorType.File,
|
|
98
|
-
options: {
|
|
99
|
-
config: {
|
|
100
|
-
directory: envVars.storageFileRoot ?? "",
|
|
101
|
-
mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout")
|
|
102
|
-
},
|
|
103
|
-
folderPrefix: envVars.entityStorageTablePrefix
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.AwsDynamoDb)) {
|
|
108
|
-
coreConfig.types.entityStorageConnector.push({
|
|
109
|
-
type: EntityStorageConnectorType.AwsDynamoDb,
|
|
110
|
-
options: {
|
|
111
|
-
config: {
|
|
112
|
-
region: envVars.awsDynamodbRegion ?? "",
|
|
113
|
-
authMode: envVars.awsDynamodbAuthMode,
|
|
114
|
-
accessKeyId: envVars.awsDynamodbAccessKeyId,
|
|
115
|
-
secretAccessKey: envVars.awsDynamodbSecretAccessKey,
|
|
116
|
-
endpoint: envVars.awsDynamodbEndpoint,
|
|
117
|
-
connectionTimeoutMs: envMs(envVars, "awsDynamodbConnectionTimeout"),
|
|
118
|
-
mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout")
|
|
119
|
-
},
|
|
120
|
-
tablePrefix: envVars.entityStorageTablePrefix
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.AzureCosmosDb)) {
|
|
125
|
-
coreConfig.types.entityStorageConnector.push({
|
|
126
|
-
type: EntityStorageConnectorType.AzureCosmosDb,
|
|
127
|
-
options: {
|
|
128
|
-
config: {
|
|
129
|
-
endpoint: envVars.azureCosmosdbEndpoint ?? "",
|
|
130
|
-
key: envVars.azureCosmosdbKey ?? "",
|
|
131
|
-
databaseId: envVars.azureCosmosdbDatabaseId ?? "",
|
|
132
|
-
containerId: envVars.azureCosmosdbContainerId ?? "",
|
|
133
|
-
mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout")
|
|
134
|
-
},
|
|
135
|
-
tablePrefix: envVars.entityStorageTablePrefix
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.GcpFirestoreDb)) {
|
|
140
|
-
coreConfig.types.entityStorageConnector.push({
|
|
141
|
-
type: EntityStorageConnectorType.GcpFirestoreDb,
|
|
142
|
-
options: {
|
|
143
|
-
config: {
|
|
144
|
-
projectId: envVars.gcpFirestoreProjectId ?? "",
|
|
145
|
-
credentials: envVars.gcpFirestoreCredentials ?? "",
|
|
146
|
-
databaseId: envVars.gcpFirestoreDatabaseId ?? "",
|
|
147
|
-
collectionName: envVars.gcpFirestoreCollectionName ?? "",
|
|
148
|
-
endpoint: envVars.gcpFirestoreEndpoint ?? "",
|
|
149
|
-
mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout")
|
|
150
|
-
},
|
|
151
|
-
tablePrefix: envVars.entityStorageTablePrefix
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.ScyllaDb)) {
|
|
156
|
-
coreConfig.types.entityStorageConnector.push({
|
|
157
|
-
type: EntityStorageConnectorType.ScyllaDb,
|
|
158
|
-
options: {
|
|
159
|
-
config: {
|
|
160
|
-
hosts: commaSeparatedListToArray(envVars.scylladbHosts),
|
|
161
|
-
localDataCenter: envVars.scylladbLocalDataCenter ?? "",
|
|
162
|
-
keyspace: envVars.scylladbKeyspace ?? "",
|
|
163
|
-
port: envInteger(envVars, "scylladbPort"),
|
|
164
|
-
mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout"),
|
|
165
|
-
pool: {
|
|
166
|
-
coreConnectionsPerHost: envCount(envVars, "scylladbPoolCoreConnectionsPerHost"),
|
|
167
|
-
maxRequestsPerConnection: envCount(envVars, "scylladbPoolMaxRequestsPerConnection")
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
tablePrefix: envVars.entityStorageTablePrefix
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.MySqlDb)) {
|
|
175
|
-
coreConfig.types.entityStorageConnector.push({
|
|
176
|
-
type: EntityStorageConnectorType.MySqlDb,
|
|
177
|
-
options: {
|
|
178
|
-
config: {
|
|
179
|
-
host: envVars.mySqlHost ?? "",
|
|
180
|
-
port: envInteger(envVars, "mySqlPort"),
|
|
181
|
-
user: envVars.mySqlUser ?? "",
|
|
182
|
-
password: envVars.mySqlPassword ?? "",
|
|
183
|
-
database: envVars.mySqlDatabase ?? "",
|
|
184
|
-
mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout"),
|
|
185
|
-
pool: {
|
|
186
|
-
connectionLimit: envCount(envVars, "mySqlPoolConnectionLimit"),
|
|
187
|
-
maxIdle: envCount(envVars, "mySqlPoolMaxIdle"),
|
|
188
|
-
idleTimeout: envMs(envVars, "mySqlPoolIdleTimeout"),
|
|
189
|
-
enableKeepAlive: envBoolean(envVars, "mySqlPoolEnableKeepAlive"),
|
|
190
|
-
waitForConnections: envBoolean(envVars, "mySqlPoolWaitForConnections"),
|
|
191
|
-
queueLimit: envCount(envVars, "mySqlPoolQueueLimit")
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
tablePrefix: envVars.entityStorageTablePrefix
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.MongoDb)) {
|
|
199
|
-
coreConfig.types.entityStorageConnector.push({
|
|
200
|
-
type: EntityStorageConnectorType.MongoDb,
|
|
201
|
-
options: {
|
|
202
|
-
config: {
|
|
203
|
-
host: envVars.mongoDbHost ?? "",
|
|
204
|
-
port: envInteger(envVars, "mongoDbPort"),
|
|
205
|
-
user: envVars.mongoDbUser ?? "",
|
|
206
|
-
password: envVars.mongoDbPassword ?? "",
|
|
207
|
-
database: envVars.mongoDbDatabase ?? "",
|
|
208
|
-
mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout"),
|
|
209
|
-
pool: {
|
|
210
|
-
maxPoolSize: envCount(envVars, "mongoDbPoolMaxPoolSize"),
|
|
211
|
-
minPoolSize: envCount(envVars, "mongoDbPoolMinPoolSize"),
|
|
212
|
-
maxIdleTimeMs: envMs(envVars, "mongoDbPoolMaxIdleTime"),
|
|
213
|
-
waitQueueTimeoutMs: envMs(envVars, "mongoDbPoolWaitQueueTimeout")
|
|
214
|
-
}
|
|
215
|
-
},
|
|
216
|
-
tablePrefix: envVars.entityStorageTablePrefix
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.PostgreSql)) {
|
|
221
|
-
coreConfig.types.entityStorageConnector.push({
|
|
222
|
-
type: EntityStorageConnectorType.PostgreSql,
|
|
223
|
-
options: {
|
|
224
|
-
config: {
|
|
225
|
-
host: envVars.postgreSqlHost ?? "",
|
|
226
|
-
port: envInteger(envVars, "postgreSqlPort"),
|
|
227
|
-
user: envVars.postgreSqlUser ?? "",
|
|
228
|
-
password: envVars.postgreSqlPassword ?? "",
|
|
229
|
-
database: envVars.postgreSqlDatabase ?? "",
|
|
230
|
-
mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout"),
|
|
231
|
-
pool: {
|
|
232
|
-
max: envCount(envVars, "postgreSqlPoolMax"),
|
|
233
|
-
idleTimeout: envSeconds(envVars, "postgreSqlPoolIdleTimeout"),
|
|
234
|
-
connectTimeout: envSeconds(envVars, "postgreSqlPoolConnectTimeout"),
|
|
235
|
-
maxLifetime: envSeconds(envVars, "postgreSqlPoolMaxLifetime")
|
|
88
|
+
const entityStorageConnectorTypes = envListToArray(envVars, "entityStorageConnectorType", Object.values(EntityStorageConnectorType));
|
|
89
|
+
for (const entityStorageConnectorType of entityStorageConnectorTypes) {
|
|
90
|
+
if (entityStorageConnectorType === EntityStorageConnectorType.Memory) {
|
|
91
|
+
coreConfig.types.entityStorageConnector.push({
|
|
92
|
+
type: EntityStorageConnectorType.Memory,
|
|
93
|
+
options: {
|
|
94
|
+
config: {
|
|
95
|
+
mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout")
|
|
236
96
|
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
else if (entityStorageConnectorType === EntityStorageConnectorType.File) {
|
|
101
|
+
coreConfig.types.entityStorageConnector.push({
|
|
102
|
+
type: EntityStorageConnectorType.File,
|
|
103
|
+
options: {
|
|
104
|
+
config: {
|
|
105
|
+
directory: envVars.storageFileRoot ?? "",
|
|
106
|
+
mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout")
|
|
107
|
+
},
|
|
108
|
+
folderPrefix: envVars.entityStorageTablePrefix
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
else if (entityStorageConnectorType === EntityStorageConnectorType.AwsDynamoDb) {
|
|
113
|
+
coreConfig.types.entityStorageConnector.push({
|
|
114
|
+
type: EntityStorageConnectorType.AwsDynamoDb,
|
|
115
|
+
options: {
|
|
116
|
+
config: {
|
|
117
|
+
region: envVars.awsDynamodbRegion ?? "",
|
|
118
|
+
authMode: envVars.awsDynamodbAuthMode,
|
|
119
|
+
accessKeyId: envVars.awsDynamodbAccessKeyId,
|
|
120
|
+
secretAccessKey: envVars.awsDynamodbSecretAccessKey,
|
|
121
|
+
endpoint: envVars.awsDynamodbEndpoint,
|
|
122
|
+
connectionTimeoutMs: envMs(envVars, "awsDynamodbConnectionTimeout"),
|
|
123
|
+
mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout")
|
|
124
|
+
},
|
|
125
|
+
tablePrefix: envVars.entityStorageTablePrefix
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
else if (entityStorageConnectorType === EntityStorageConnectorType.AzureCosmosDb) {
|
|
130
|
+
coreConfig.types.entityStorageConnector.push({
|
|
131
|
+
type: EntityStorageConnectorType.AzureCosmosDb,
|
|
132
|
+
options: {
|
|
133
|
+
config: {
|
|
134
|
+
endpoint: envVars.azureCosmosdbEndpoint ?? "",
|
|
135
|
+
key: envVars.azureCosmosdbKey ?? "",
|
|
136
|
+
databaseId: envVars.azureCosmosdbDatabaseId ?? "",
|
|
137
|
+
containerId: envVars.azureCosmosdbContainerId ?? "",
|
|
138
|
+
mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout")
|
|
139
|
+
},
|
|
140
|
+
tablePrefix: envVars.entityStorageTablePrefix
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
else if (entityStorageConnectorType === EntityStorageConnectorType.GcpFirestoreDb) {
|
|
145
|
+
coreConfig.types.entityStorageConnector.push({
|
|
146
|
+
type: EntityStorageConnectorType.GcpFirestoreDb,
|
|
147
|
+
options: {
|
|
148
|
+
config: {
|
|
149
|
+
projectId: envVars.gcpFirestoreProjectId ?? "",
|
|
150
|
+
credentials: envVars.gcpFirestoreCredentials ?? "",
|
|
151
|
+
databaseId: envVars.gcpFirestoreDatabaseId ?? "",
|
|
152
|
+
collectionName: envVars.gcpFirestoreCollectionName ?? "",
|
|
153
|
+
endpoint: envVars.gcpFirestoreEndpoint ?? "",
|
|
154
|
+
mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout")
|
|
155
|
+
},
|
|
156
|
+
tablePrefix: envVars.entityStorageTablePrefix
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
else if (entityStorageConnectorType === EntityStorageConnectorType.ScyllaDb) {
|
|
161
|
+
coreConfig.types.entityStorageConnector.push({
|
|
162
|
+
type: EntityStorageConnectorType.ScyllaDb,
|
|
163
|
+
options: {
|
|
164
|
+
config: {
|
|
165
|
+
hosts: commaSeparatedListToArray(envVars.scylladbHosts),
|
|
166
|
+
localDataCenter: envVars.scylladbLocalDataCenter ?? "",
|
|
167
|
+
keyspace: envVars.scylladbKeyspace ?? "",
|
|
168
|
+
port: envInteger(envVars, "scylladbPort"),
|
|
169
|
+
mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout"),
|
|
170
|
+
pool: {
|
|
171
|
+
coreConnectionsPerHost: envCount(envVars, "scylladbPoolCoreConnectionsPerHost"),
|
|
172
|
+
maxRequestsPerConnection: envCount(envVars, "scylladbPoolMaxRequestsPerConnection")
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
tablePrefix: envVars.entityStorageTablePrefix
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
else if (entityStorageConnectorType === EntityStorageConnectorType.MySqlDb) {
|
|
180
|
+
coreConfig.types.entityStorageConnector.push({
|
|
181
|
+
type: EntityStorageConnectorType.MySqlDb,
|
|
182
|
+
options: {
|
|
183
|
+
config: {
|
|
184
|
+
host: envVars.mySqlHost ?? "",
|
|
185
|
+
port: envInteger(envVars, "mySqlPort"),
|
|
186
|
+
user: envVars.mySqlUser ?? "",
|
|
187
|
+
password: envVars.mySqlPassword ?? "",
|
|
188
|
+
database: envVars.mySqlDatabase ?? "",
|
|
189
|
+
mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout"),
|
|
190
|
+
pool: {
|
|
191
|
+
connectionLimit: envCount(envVars, "mySqlPoolConnectionLimit"),
|
|
192
|
+
maxIdle: envCount(envVars, "mySqlPoolMaxIdle"),
|
|
193
|
+
idleTimeout: envMs(envVars, "mySqlPoolIdleTimeout"),
|
|
194
|
+
enableKeepAlive: envBoolean(envVars, "mySqlPoolEnableKeepAlive"),
|
|
195
|
+
waitForConnections: envBoolean(envVars, "mySqlPoolWaitForConnections"),
|
|
196
|
+
queueLimit: envCount(envVars, "mySqlPoolQueueLimit")
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
tablePrefix: envVars.entityStorageTablePrefix
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
else if (entityStorageConnectorType === EntityStorageConnectorType.MongoDb) {
|
|
204
|
+
coreConfig.types.entityStorageConnector.push({
|
|
205
|
+
type: EntityStorageConnectorType.MongoDb,
|
|
206
|
+
options: {
|
|
207
|
+
config: {
|
|
208
|
+
host: envVars.mongoDbHost ?? "",
|
|
209
|
+
port: envInteger(envVars, "mongoDbPort"),
|
|
210
|
+
user: envVars.mongoDbUser ?? "",
|
|
211
|
+
password: envVars.mongoDbPassword ?? "",
|
|
212
|
+
database: envVars.mongoDbDatabase ?? "",
|
|
213
|
+
mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout"),
|
|
214
|
+
pool: {
|
|
215
|
+
maxPoolSize: envCount(envVars, "mongoDbPoolMaxPoolSize"),
|
|
216
|
+
minPoolSize: envCount(envVars, "mongoDbPoolMinPoolSize"),
|
|
217
|
+
maxIdleTimeMs: envMs(envVars, "mongoDbPoolMaxIdleTime"),
|
|
218
|
+
waitQueueTimeoutMs: envMs(envVars, "mongoDbPoolWaitQueueTimeout")
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
tablePrefix: envVars.entityStorageTablePrefix
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
else if (entityStorageConnectorType === EntityStorageConnectorType.PostgreSql) {
|
|
226
|
+
coreConfig.types.entityStorageConnector.push({
|
|
227
|
+
type: EntityStorageConnectorType.PostgreSql,
|
|
228
|
+
options: {
|
|
229
|
+
config: {
|
|
230
|
+
host: envVars.postgreSqlHost ?? "",
|
|
231
|
+
port: envInteger(envVars, "postgreSqlPort"),
|
|
232
|
+
user: envVars.postgreSqlUser ?? "",
|
|
233
|
+
password: envVars.postgreSqlPassword ?? "",
|
|
234
|
+
database: envVars.postgreSqlDatabase ?? "",
|
|
235
|
+
mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout"),
|
|
236
|
+
pool: {
|
|
237
|
+
max: envCount(envVars, "postgreSqlPoolMax"),
|
|
238
|
+
idleTimeout: envSeconds(envVars, "postgreSqlPoolIdleTimeout"),
|
|
239
|
+
connectTimeout: envSeconds(envVars, "postgreSqlPoolConnectTimeout"),
|
|
240
|
+
maxLifetime: envSeconds(envVars, "postgreSqlPoolMaxLifetime")
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
tablePrefix: envVars.entityStorageTablePrefix
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
}
|
|
241
247
|
}
|
|
242
248
|
const defaultEntityStorageConnectorType = envVars.entityStorageConnectorDefault ?? entityStorageConnectorTypes[0];
|
|
243
249
|
if (Is.arrayValue(entityStorageConnectorTypes)) {
|
|
@@ -257,85 +263,88 @@ async function configureEntityStorage(coreConfig, envVars) {
|
|
|
257
263
|
*/
|
|
258
264
|
async function configureBlobStorage(coreConfig, envVars) {
|
|
259
265
|
coreConfig.types.blobStorageConnector ??= [];
|
|
260
|
-
const blobStorageConnectorTypes =
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
if (blobStorageConnectorTypes.includes(BlobStorageConnectorType.Ipfs)) {
|
|
280
|
-
coreConfig.types.blobStorageConnector.push({
|
|
281
|
-
type: BlobStorageConnectorType.Ipfs,
|
|
282
|
-
options: {
|
|
283
|
-
config: {
|
|
284
|
-
apiUrl: envVars.ipfsApiUrl ?? "",
|
|
285
|
-
bearerToken: envVars.ipfsBearerToken
|
|
266
|
+
const blobStorageConnectorTypes = envListToArray(envVars, "blobStorageConnectorType", Object.values(BlobStorageConnectorType));
|
|
267
|
+
for (const blobStorageConnectorType of blobStorageConnectorTypes) {
|
|
268
|
+
if (blobStorageConnectorType === BlobStorageConnectorType.Memory) {
|
|
269
|
+
coreConfig.types.blobStorageConnector.push({
|
|
270
|
+
type: BlobStorageConnectorType.Memory
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
else if (blobStorageConnectorType === BlobStorageConnectorType.File) {
|
|
274
|
+
coreConfig.types.blobStorageConnector.push({
|
|
275
|
+
type: BlobStorageConnectorType.File,
|
|
276
|
+
options: {
|
|
277
|
+
config: {
|
|
278
|
+
directory: Is.stringValue(envVars.storageFileRoot)
|
|
279
|
+
? path.join(envVars.storageFileRoot, "blob-storage")
|
|
280
|
+
: ""
|
|
281
|
+
},
|
|
282
|
+
storagePrefix: envVars.blobStoragePrefix
|
|
286
283
|
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
else if (blobStorageConnectorType === BlobStorageConnectorType.Ipfs) {
|
|
287
|
+
coreConfig.types.blobStorageConnector.push({
|
|
288
|
+
type: BlobStorageConnectorType.Ipfs,
|
|
289
|
+
options: {
|
|
290
|
+
config: {
|
|
291
|
+
apiUrl: envVars.ipfsApiUrl ?? "",
|
|
292
|
+
bearerToken: envVars.ipfsBearerToken
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
else if (blobStorageConnectorType === BlobStorageConnectorType.AwsS3) {
|
|
298
|
+
coreConfig.types.blobStorageConnector.push({
|
|
299
|
+
type: BlobStorageConnectorType.AwsS3,
|
|
300
|
+
options: {
|
|
301
|
+
config: {
|
|
302
|
+
region: envVars.awsS3Region ?? "",
|
|
303
|
+
bucketName: envVars.awsS3BucketName ?? "",
|
|
304
|
+
authMode: envVars.awsS3AuthMode,
|
|
305
|
+
accessKeyId: envVars.awsS3AccessKeyId,
|
|
306
|
+
secretAccessKey: envVars.awsS3SecretAccessKey,
|
|
307
|
+
endpoint: envVars.awsS3Endpoint
|
|
308
|
+
},
|
|
309
|
+
storagePrefix: envVars.blobStoragePrefix
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
else if (blobStorageConnectorType === BlobStorageConnectorType.AzureStorage) {
|
|
314
|
+
coreConfig.types.blobStorageConnector.push({
|
|
315
|
+
type: BlobStorageConnectorType.AzureStorage,
|
|
316
|
+
options: {
|
|
317
|
+
config: {
|
|
318
|
+
accountName: envVars.azureStorageAccountName ?? "",
|
|
319
|
+
accountKey: envVars.azureStorageAccountKey ?? "",
|
|
320
|
+
containerName: envVars.azureStorageContainerName ?? "",
|
|
321
|
+
endpoint: envVars.azureStorageEndpoint ?? ""
|
|
322
|
+
},
|
|
323
|
+
storagePrefix: envVars.blobStoragePrefix
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
else if (blobStorageConnectorType === BlobStorageConnectorType.GcpStorage) {
|
|
328
|
+
coreConfig.types.blobStorageConnector.push({
|
|
329
|
+
type: BlobStorageConnectorType.GcpStorage,
|
|
330
|
+
options: {
|
|
331
|
+
config: {
|
|
332
|
+
projectId: envVars.gcpStorageProjectId ?? "",
|
|
333
|
+
credentials: envVars.gcpStorageCredentials ?? "",
|
|
334
|
+
bucketName: envVars.gcpStorageBucketName ?? "",
|
|
335
|
+
apiEndpoint: envVars.gcpFirestoreEndpoint
|
|
336
|
+
},
|
|
337
|
+
storagePrefix: envVars.blobStoragePrefix
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
}
|
|
333
341
|
}
|
|
334
342
|
if (Is.arrayValue(blobStorageConnectorTypes)) {
|
|
335
343
|
const defaultStorageConnectorType = envVars.blobStorageConnectorDefault ?? blobStorageConnectorTypes[0];
|
|
336
344
|
for (const config of coreConfig.types.blobStorageConnector) {
|
|
337
345
|
if (config.type === defaultStorageConnectorType) {
|
|
338
346
|
config.isDefault = true;
|
|
347
|
+
break;
|
|
339
348
|
}
|
|
340
349
|
}
|
|
341
350
|
}
|
|
@@ -361,7 +370,7 @@ async function configureBlobStorage(coreConfig, envVars) {
|
|
|
361
370
|
*/
|
|
362
371
|
async function configureLogging(coreConfig, envVars) {
|
|
363
372
|
coreConfig.types.loggingConnector ??= [];
|
|
364
|
-
const loggingConnectorTypes =
|
|
373
|
+
const loggingConnectorTypes = envListToArray(envVars, "loggingConnector", Object.values(LoggingConnectorType));
|
|
365
374
|
let additionalConnectorCount = 0;
|
|
366
375
|
for (const loggingConnector of loggingConnectorTypes) {
|
|
367
376
|
if (loggingConnector === LoggingConnectorType.Console) {
|
|
@@ -386,8 +395,7 @@ async function configureLogging(coreConfig, envVars) {
|
|
|
386
395
|
retainForMs: envMinToMs(envVars, "loggingRetainFor"),
|
|
387
396
|
maxEntries: envCount(envVars, "loggingMaxEntries"),
|
|
388
397
|
retentionIntervalMs: envMinToMs(envVars, "loggingRetentionInterval"),
|
|
389
|
-
retentionBatchSize: envCount(envVars, "loggingRetentionBatchSize")
|
|
390
|
-
mutexTimeoutMs: envMs(envVars, "loggingMutexTimeout")
|
|
398
|
+
retentionBatchSize: envCount(envVars, "loggingRetentionBatchSize")
|
|
391
399
|
}
|
|
392
400
|
}
|
|
393
401
|
});
|
|
@@ -424,8 +432,7 @@ async function configureLogging(coreConfig, envVars) {
|
|
|
424
432
|
directory: envVars.loggingFileDirectory ?? envVars.storageFileRoot ?? "",
|
|
425
433
|
filename: envVars.loggingFileFilename,
|
|
426
434
|
maxFileSizeBytes: envCount(envVars, "loggingFileMaxFileSizeBytes"),
|
|
427
|
-
maxRetainedFiles: envCount(envVars, "loggingFileMaxRetainedFiles")
|
|
428
|
-
mutexTimeoutMs: envMs(envVars, "loggingMutexTimeout")
|
|
435
|
+
maxRetainedFiles: envCount(envVars, "loggingFileMaxRetainedFiles")
|
|
429
436
|
}
|
|
430
437
|
}
|
|
431
438
|
});
|
|
@@ -463,7 +470,8 @@ async function configureLogging(coreConfig, envVars) {
|
|
|
463
470
|
*/
|
|
464
471
|
async function configureVault(coreConfig, envVars) {
|
|
465
472
|
coreConfig.types.vaultConnector ??= [];
|
|
466
|
-
|
|
473
|
+
const vaultConnectorType = envChoice(envVars, "vaultConnector", Object.values(VaultConnectorType));
|
|
474
|
+
if (vaultConnectorType === VaultConnectorType.EntityStorage) {
|
|
467
475
|
coreConfig.types.vaultConnector.push({
|
|
468
476
|
type: VaultConnectorType.EntityStorage,
|
|
469
477
|
options: {
|
|
@@ -473,7 +481,7 @@ async function configureVault(coreConfig, envVars) {
|
|
|
473
481
|
}
|
|
474
482
|
});
|
|
475
483
|
}
|
|
476
|
-
else if (
|
|
484
|
+
else if (vaultConnectorType === VaultConnectorType.Hashicorp) {
|
|
477
485
|
coreConfig.types.vaultConnector.push({
|
|
478
486
|
type: VaultConnectorType.Hashicorp,
|
|
479
487
|
options: {
|
|
@@ -496,7 +504,17 @@ async function configureBackgroundTask(coreConfig, envVars) {
|
|
|
496
504
|
coreConfig.types.backgroundTaskComponent ??= [];
|
|
497
505
|
if (isBackgroundTasksRequired(envVars)) {
|
|
498
506
|
coreConfig.types.backgroundTaskComponent.push({
|
|
499
|
-
type: BackgroundTaskComponentType.Service
|
|
507
|
+
type: BackgroundTaskComponentType.Service,
|
|
508
|
+
options: {
|
|
509
|
+
config: {
|
|
510
|
+
maxSystemWorkerCount: envCount(envVars, "backgroundTaskMaxSystemWorkerCount", cpus().length * 2),
|
|
511
|
+
taskInterval: envMs(envVars, "backgroundTaskInterval"),
|
|
512
|
+
retryInterval: envMs(envVars, "backgroundTaskRetryInterval"),
|
|
513
|
+
cleanupInterval: envMs(envVars, "backgroundTaskCleanupInterval"),
|
|
514
|
+
workerShutdownTimeout: envMs(envVars, "backgroundTaskWorkerShutdownTimeout"),
|
|
515
|
+
maxDispatchCount: envCount(envVars, "backgroundTaskMaxDispatchCount")
|
|
516
|
+
}
|
|
517
|
+
}
|
|
500
518
|
});
|
|
501
519
|
}
|
|
502
520
|
}
|
|
@@ -508,7 +526,8 @@ async function configureBackgroundTask(coreConfig, envVars) {
|
|
|
508
526
|
*/
|
|
509
527
|
async function configureEventBus(coreConfig, envVars) {
|
|
510
528
|
coreConfig.types.eventBusConnector ??= [];
|
|
511
|
-
|
|
529
|
+
const eventBusConnectorType = envChoice(envVars, "eventBusConnector", Object.values(EventBusConnectorType));
|
|
530
|
+
if (eventBusConnectorType === EventBusConnectorType.Local) {
|
|
512
531
|
coreConfig.types.eventBusConnector.push({
|
|
513
532
|
type: EventBusConnectorType.Local
|
|
514
533
|
});
|
|
@@ -526,16 +545,16 @@ async function configureEventBus(coreConfig, envVars) {
|
|
|
526
545
|
*/
|
|
527
546
|
async function configureTelemetry(coreConfig, envVars) {
|
|
528
547
|
coreConfig.types.telemetryConnector ??= [];
|
|
529
|
-
const telemetryConnectorTypes =
|
|
548
|
+
const telemetryConnectorTypes = envListToArray(envVars, "telemetryConnector", Object.values(TelemetryConnectorType));
|
|
530
549
|
let additionalConnectorCount = 0;
|
|
531
|
-
for (const
|
|
532
|
-
if (
|
|
550
|
+
for (const telemetryConnectorType of telemetryConnectorTypes) {
|
|
551
|
+
if (telemetryConnectorType === TelemetryConnectorType.Silent) {
|
|
533
552
|
coreConfig.types.telemetryConnector.push({
|
|
534
553
|
type: TelemetryConnectorType.Silent
|
|
535
554
|
});
|
|
536
555
|
additionalConnectorCount++;
|
|
537
556
|
}
|
|
538
|
-
else if (
|
|
557
|
+
else if (telemetryConnectorType === TelemetryConnectorType.EntityStorage) {
|
|
539
558
|
coreConfig.types.telemetryConnector.push({
|
|
540
559
|
type: TelemetryConnectorType.EntityStorage,
|
|
541
560
|
options: {
|
|
@@ -543,7 +562,9 @@ async function configureTelemetry(coreConfig, envVars) {
|
|
|
543
562
|
batchSize: envCount(envVars, "telemetryBatchSize"),
|
|
544
563
|
batchIntervalMs: envSecToMs(envVars, "telemetryBatchFlushInterval"),
|
|
545
564
|
maxCacheSize: envCount(envVars, "telemetryMaxCacheSize"),
|
|
546
|
-
|
|
565
|
+
flushTimeoutMs: envMs(envVars, "telemetryFlushTimeout"),
|
|
566
|
+
taskCoalesceMs: envMs(envVars, "telemetryTaskCoalesce"),
|
|
567
|
+
taskStallTimeoutMs: envMs(envVars, "telemetryTaskStallTimeout"),
|
|
547
568
|
metricDefinitionCacheCapacity: envCount(envVars, "telemetryMetricDefinitionCacheCapacity"),
|
|
548
569
|
metricDefinitionCacheTtiMs: envMs(envVars, "telemetryMetricDefinitionCacheTtiMs")
|
|
549
570
|
}
|
|
@@ -551,7 +572,7 @@ async function configureTelemetry(coreConfig, envVars) {
|
|
|
551
572
|
});
|
|
552
573
|
additionalConnectorCount++;
|
|
553
574
|
}
|
|
554
|
-
else if (
|
|
575
|
+
else if (telemetryConnectorType === TelemetryConnectorType.OpenTelemetry) {
|
|
555
576
|
let readers;
|
|
556
577
|
if (envVars.openTelemetryReader === OpenTelemetryReaderTypes.Prometheus) {
|
|
557
578
|
readers = {
|
|
@@ -614,8 +635,10 @@ async function configureMetricsCollector(coreConfig, envVars) {
|
|
|
614
635
|
cloneMode: EngineCloneMode.Never
|
|
615
636
|
});
|
|
616
637
|
coreConfig.types.metricsProducerComponent ??= [];
|
|
617
|
-
const metricsProducers =
|
|
618
|
-
|
|
638
|
+
const metricsProducers = envListToArray(envVars, "telemetryMetricsProducers", Object.values(MetricsProducerComponentType), [
|
|
639
|
+
MetricsProducerComponentType.System,
|
|
640
|
+
MetricsProducerComponentType.Process
|
|
641
|
+
]);
|
|
619
642
|
for (const producerType of metricsProducers) {
|
|
620
643
|
coreConfig.types.metricsProducerComponent.push({
|
|
621
644
|
type: producerType,
|
|
@@ -633,27 +656,28 @@ async function configureMetricsCollector(coreConfig, envVars) {
|
|
|
633
656
|
*/
|
|
634
657
|
async function configureTracing(coreConfig, envVars) {
|
|
635
658
|
coreConfig.types.tracingConnector ??= [];
|
|
636
|
-
const tracingConnectorTypes =
|
|
659
|
+
const tracingConnectorTypes = envListToArray(envVars, "tracingConnector", Object.values(TracingConnectorType));
|
|
637
660
|
let additionalConnectorCount = 0;
|
|
638
|
-
for (const
|
|
639
|
-
if (
|
|
661
|
+
for (const tracingConnectorType of tracingConnectorTypes) {
|
|
662
|
+
if (tracingConnectorType === TracingConnectorType.Silent) {
|
|
640
663
|
coreConfig.types.tracingConnector.push({
|
|
641
664
|
type: TracingConnectorType.Silent
|
|
642
665
|
});
|
|
643
666
|
additionalConnectorCount++;
|
|
644
667
|
}
|
|
645
|
-
else if (
|
|
668
|
+
else if (tracingConnectorType === TracingConnectorType.EntityStorage) {
|
|
646
669
|
coreConfig.types.tracingConnector.push({
|
|
647
|
-
type: TracingConnectorType.EntityStorage
|
|
648
|
-
options: {
|
|
649
|
-
config: {
|
|
650
|
-
mutexTimeoutMs: envMs(envVars, "tracingMutexTimeout")
|
|
651
|
-
}
|
|
652
|
-
}
|
|
670
|
+
type: TracingConnectorType.EntityStorage
|
|
653
671
|
});
|
|
654
672
|
additionalConnectorCount++;
|
|
655
673
|
}
|
|
656
|
-
else if (
|
|
674
|
+
else if (tracingConnectorType === TracingConnectorType.Console) {
|
|
675
|
+
coreConfig.types.tracingConnector.push({
|
|
676
|
+
type: TracingConnectorType.Console
|
|
677
|
+
});
|
|
678
|
+
additionalConnectorCount++;
|
|
679
|
+
}
|
|
680
|
+
else if (tracingConnectorType === TracingConnectorType.OpenTelemetry) {
|
|
657
681
|
const otelTracingConfig = {
|
|
658
682
|
tracerName: envVars.openTelemetryTracingTracerName,
|
|
659
683
|
tracerVersion: envVars.openTelemetryTracingTracerVersion
|
|
@@ -697,6 +721,80 @@ async function configureTracing(coreConfig, envVars) {
|
|
|
697
721
|
coreConfig.types.tracingComponent.push({ type: TracingComponentType.Service });
|
|
698
722
|
}
|
|
699
723
|
}
|
|
724
|
+
/**
|
|
725
|
+
* Configures the facades.
|
|
726
|
+
* @param coreConfig The core config.
|
|
727
|
+
* @param envVars The environment variables.
|
|
728
|
+
* @returns A promise that resolves when the facade configuration has been applied.
|
|
729
|
+
*/
|
|
730
|
+
async function configureFacades(coreConfig, envVars) {
|
|
731
|
+
const facadeTypes = envListToArray(envVars, "facade", Object.values(FacadeType));
|
|
732
|
+
if (!Is.arrayValue(facadeTypes)) {
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
735
|
+
coreConfig.types.facade ??= [];
|
|
736
|
+
coreConfig.facades ??= {};
|
|
737
|
+
for (const facadeType of facadeTypes) {
|
|
738
|
+
if (facadeType === FacadeType.Tracing) {
|
|
739
|
+
configureTracingFacade(coreConfig.types.facade, coreConfig.facades, envVars);
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* Configures the tracing facade.
|
|
745
|
+
* @param facadeTypeConfigs The facade type configs to add to.
|
|
746
|
+
* @param facades The facades to activate, keyed by the type name of the factory they apply to.
|
|
747
|
+
* @param envVars The environment variables.
|
|
748
|
+
*/
|
|
749
|
+
function configureTracingFacade(facadeTypeConfigs, facades, envVars) {
|
|
750
|
+
// The facade records its spans through the tracing subsystem, without it there is nothing to record to.
|
|
751
|
+
if (!isTracingEnabled(envVars)) {
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
// The facade is meaningless without factories to activate it on, so fall back to the defaults.
|
|
755
|
+
const configuredFactoryTypeNames = commaSeparatedListToArray(envVars.tracingFacadeFactories);
|
|
756
|
+
const factoryTypeNames = [
|
|
757
|
+
...new Set(Is.arrayValue(configuredFactoryTypeNames)
|
|
758
|
+
? configuredFactoryTypeNames
|
|
759
|
+
: DEFAULT_TRACING_FACADE_FACTORIES)
|
|
760
|
+
];
|
|
761
|
+
const config = {};
|
|
762
|
+
// Adding to the default excludes. We want to keep default list as a base and only add to it.
|
|
763
|
+
const excludeParams = commaSeparatedListToArray(envVars.tracingFacadeExcludeParams);
|
|
764
|
+
if (Is.arrayValue(excludeParams)) {
|
|
765
|
+
config.excludeParams = [
|
|
766
|
+
...new Set([...TracingFacade.DEFAULT_EXCLUDE_PARAMS, ...excludeParams])
|
|
767
|
+
];
|
|
768
|
+
}
|
|
769
|
+
const excludeMethods = commaSeparatedListToArray(envVars.tracingFacadeExcludeMethods);
|
|
770
|
+
if (Is.arrayValue(excludeMethods)) {
|
|
771
|
+
config.excludeMethods = [
|
|
772
|
+
...new Set([...TracingFacade.DEFAULT_EXCLUDE_METHODS, ...excludeMethods])
|
|
773
|
+
];
|
|
774
|
+
}
|
|
775
|
+
const includeObjects = commaSeparatedListToArray(envVars.tracingFacadeIncludeObjects);
|
|
776
|
+
if (Is.arrayValue(includeObjects)) {
|
|
777
|
+
config.includeObjects = includeObjects;
|
|
778
|
+
}
|
|
779
|
+
facadeTypeConfigs.push({
|
|
780
|
+
type: FacadeType.Tracing,
|
|
781
|
+
options: Is.objectValue(config) ? { config } : undefined,
|
|
782
|
+
cloneMode: EngineCloneMode.Always
|
|
783
|
+
});
|
|
784
|
+
const componentExcludeTypes = [
|
|
785
|
+
...new Set([
|
|
786
|
+
...DEFAULT_TRACING_FACADE_COMPONENT_EXCLUDE_TYPES,
|
|
787
|
+
...commaSeparatedListToArray(envVars.tracingFacadeComponentExcludeTypes)
|
|
788
|
+
])
|
|
789
|
+
];
|
|
790
|
+
for (const factoryTypeName of factoryTypeNames) {
|
|
791
|
+
facades[factoryTypeName] ??= [];
|
|
792
|
+
facades[factoryTypeName].push({
|
|
793
|
+
name: TRACING_FACADE_NAME,
|
|
794
|
+
excludeTypes: factoryTypeName === COMPONENT_FACTORY_TYPE_NAME ? componentExcludeTypes : undefined
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
}
|
|
700
798
|
/**
|
|
701
799
|
* Configures the automation.
|
|
702
800
|
* @param coreConfig The core config.
|
|
@@ -709,15 +807,13 @@ async function configureAutomation(coreConfig, envVars) {
|
|
|
709
807
|
coreConfig.types.automationComponent.push({
|
|
710
808
|
type: AutomationComponentType.Service
|
|
711
809
|
});
|
|
712
|
-
const automationActionTypes =
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
});
|
|
720
|
-
}
|
|
810
|
+
const automationActionTypes = envListToArray(envVars, "automationActionTypes", Object.values(AutomationActionType));
|
|
811
|
+
coreConfig.types.automationAction ??= [];
|
|
812
|
+
for (const actionType of automationActionTypes) {
|
|
813
|
+
coreConfig.types.automationAction.push({
|
|
814
|
+
type: actionType,
|
|
815
|
+
isMultiInstance: true
|
|
816
|
+
});
|
|
721
817
|
}
|
|
722
818
|
}
|
|
723
819
|
}
|
|
@@ -736,7 +832,8 @@ async function configureHealth(coreConfig, envVars) {
|
|
|
736
832
|
config: {
|
|
737
833
|
healthCheckInterval: envSecToMs(envVars, "healthInterval"),
|
|
738
834
|
healthCheckApplicationInterval: envSecToMs(envVars, "healthApplicationInterval"),
|
|
739
|
-
initialInterval: envSecToMs(envVars, "healthStartupInterval")
|
|
835
|
+
initialInterval: envSecToMs(envVars, "healthStartupInterval"),
|
|
836
|
+
excludeCloneComponents: envListToArray(envVars, "healthExcludeCloneComponents", undefined, DEFAULT_HEALTH_EXCLUDE_CLONE_COMPONENTS)
|
|
740
837
|
}
|
|
741
838
|
},
|
|
742
839
|
cloneMode: EngineCloneMode.Never
|
|
@@ -820,69 +917,89 @@ async function configureContextIdHandlers(coreConfig, envVars) {
|
|
|
820
917
|
* @returns A promise that resolves when the messaging configuration has been applied.
|
|
821
918
|
*/
|
|
822
919
|
async function configureMessaging(coreConfig, envVars) {
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
}
|
|
920
|
+
coreConfig.types.messagingEmailConnector ??= [];
|
|
921
|
+
coreConfig.types.messagingSmsConnector ??= [];
|
|
922
|
+
coreConfig.types.messagingPushNotificationConnector ??= [];
|
|
923
|
+
const messagingEmailConnectorType = envChoice(envVars, "messagingEmailConnector", Object.values(MessagingEmailConnectorType));
|
|
924
|
+
if (messagingEmailConnectorType === MessagingEmailConnectorType.EntityStorage) {
|
|
925
|
+
coreConfig.types.messagingEmailConnector.push({
|
|
926
|
+
type: MessagingEmailConnectorType.EntityStorage
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
else if (messagingEmailConnectorType === MessagingEmailConnectorType.Aws) {
|
|
930
|
+
coreConfig.types.messagingEmailConnector.push({
|
|
931
|
+
type: MessagingEmailConnectorType.Aws,
|
|
932
|
+
options: {
|
|
933
|
+
config: {
|
|
934
|
+
region: envVars.awsSesRegion ?? "",
|
|
935
|
+
authMode: envVars.awsSesAuthMode,
|
|
936
|
+
accessKeyId: envVars.awsSesAccessKeyId,
|
|
937
|
+
secretAccessKey: envVars.awsSesSecretAccessKey,
|
|
938
|
+
endpoint: envVars.awsSesEndpoint
|
|
843
939
|
}
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
authMode: envVars.awsSesAuthMode,
|
|
858
|
-
accessKeyId: envVars.awsSesAccessKeyId,
|
|
859
|
-
secretAccessKey: envVars.awsSesSecretAccessKey,
|
|
860
|
-
endpoint: envVars.awsSesEndpoint
|
|
861
|
-
}
|
|
940
|
+
}
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
else if (messagingEmailConnectorType === MessagingEmailConnectorType.Smtp) {
|
|
944
|
+
coreConfig.types.messagingEmailConnector.push({
|
|
945
|
+
type: MessagingEmailConnectorType.Smtp,
|
|
946
|
+
options: {
|
|
947
|
+
config: {
|
|
948
|
+
host: envVars.smtpHost ?? "",
|
|
949
|
+
port: envInteger(envVars, "smtpPort"),
|
|
950
|
+
secure: envBoolean(envVars, "smtpSecure"),
|
|
951
|
+
username: envVars.smtpUsername,
|
|
952
|
+
password: envVars.smtpPassword
|
|
862
953
|
}
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
}
|
|
954
|
+
}
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
const messagingSmsConnectorType = envChoice(envVars, "messagingSmsConnector", Object.values(MessagingSmsConnectorType));
|
|
958
|
+
if (messagingSmsConnectorType === MessagingSmsConnectorType.EntityStorage) {
|
|
959
|
+
coreConfig.types.messagingSmsConnector.push({
|
|
960
|
+
type: MessagingSmsConnectorType.EntityStorage
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
else if (messagingSmsConnectorType === MessagingSmsConnectorType.Aws) {
|
|
964
|
+
coreConfig.types.messagingSmsConnector.push({
|
|
965
|
+
type: MessagingSmsConnectorType.Aws,
|
|
966
|
+
options: {
|
|
967
|
+
config: {
|
|
968
|
+
region: envVars.awsSesRegion ?? "",
|
|
969
|
+
authMode: envVars.awsSesAuthMode,
|
|
970
|
+
accessKeyId: envVars.awsSesAccessKeyId,
|
|
971
|
+
secretAccessKey: envVars.awsSesSecretAccessKey,
|
|
972
|
+
endpoint: envVars.awsSesEndpoint
|
|
883
973
|
}
|
|
884
|
-
}
|
|
885
|
-
}
|
|
974
|
+
}
|
|
975
|
+
});
|
|
976
|
+
}
|
|
977
|
+
const messagingPushConnectorType = envChoice(envVars, "messagingPushNotificationConnector", Object.values(MessagingPushNotificationConnectorType));
|
|
978
|
+
if (messagingPushConnectorType === MessagingPushNotificationConnectorType.EntityStorage) {
|
|
979
|
+
coreConfig.types.messagingPushNotificationConnector.push({
|
|
980
|
+
type: MessagingPushNotificationConnectorType.EntityStorage
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
else if (messagingPushConnectorType === MessagingPushNotificationConnectorType.Aws) {
|
|
984
|
+
coreConfig.types.messagingPushNotificationConnector.push({
|
|
985
|
+
type: MessagingPushNotificationConnectorType.Aws,
|
|
986
|
+
options: {
|
|
987
|
+
config: {
|
|
988
|
+
region: envVars.awsSesRegion ?? "",
|
|
989
|
+
authMode: envVars.awsSesAuthMode,
|
|
990
|
+
accessKeyId: envVars.awsSesAccessKeyId,
|
|
991
|
+
secretAccessKey: envVars.awsSesSecretAccessKey,
|
|
992
|
+
endpoint: envVars.awsSesEndpoint,
|
|
993
|
+
applicationsSettings: envArray(envVars, "awsMessagingPushNotificationApplications", [])
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
// If any messaging connectors are configured, then we should configure the messaging admin and
|
|
999
|
+
// service components as well since they are required for the messaging connectors to work.
|
|
1000
|
+
if (coreConfig.types.messagingEmailConnector.length > 0 ||
|
|
1001
|
+
coreConfig.types.messagingSmsConnector.length > 0 ||
|
|
1002
|
+
coreConfig.types.messagingPushNotificationConnector.length > 0) {
|
|
886
1003
|
coreConfig.types.messagingAdminComponent ??= [];
|
|
887
1004
|
coreConfig.types.messagingAdminComponent.push({
|
|
888
1005
|
type: MessagingAdminComponentType.Service
|
|
@@ -891,6 +1008,40 @@ async function configureMessaging(coreConfig, envVars) {
|
|
|
891
1008
|
coreConfig.types.messagingComponent.push({ type: MessagingComponentType.Service });
|
|
892
1009
|
}
|
|
893
1010
|
}
|
|
1011
|
+
/**
|
|
1012
|
+
* Configures mailbox components, mail storage components, and email protocol connectors.
|
|
1013
|
+
* @param coreConfig The core config.
|
|
1014
|
+
* @param envVars The environment variables.
|
|
1015
|
+
* @returns A promise that resolves when the mailbox configuration has been applied.
|
|
1016
|
+
*/
|
|
1017
|
+
async function configureMailbox(coreConfig, envVars) {
|
|
1018
|
+
coreConfig.types.emailProtocolConnector ??= [];
|
|
1019
|
+
const emailProtocolConnectorTypes = envListToArray(envVars, "emailProtocolConnector", Object.values(EmailProtocolConnectorType));
|
|
1020
|
+
for (const emailProtocolConnectorType of emailProtocolConnectorTypes) {
|
|
1021
|
+
coreConfig.types.emailProtocolConnector.push({
|
|
1022
|
+
type: emailProtocolConnectorType,
|
|
1023
|
+
options: {
|
|
1024
|
+
config: {}
|
|
1025
|
+
},
|
|
1026
|
+
cloneMode: EngineCloneMode.Never,
|
|
1027
|
+
isMultiInstance: true
|
|
1028
|
+
});
|
|
1029
|
+
}
|
|
1030
|
+
// If email protocol connectors are configured, then we should configure the mailbox and mail store
|
|
1031
|
+
// components as well, since they are required for the email protocol connectors to work.
|
|
1032
|
+
if (coreConfig.types.emailProtocolConnector.length > 0) {
|
|
1033
|
+
coreConfig.types.mailStorageComponent ??= [];
|
|
1034
|
+
coreConfig.types.mailStorageComponent.push({
|
|
1035
|
+
type: MailStorageComponentType.Service,
|
|
1036
|
+
cloneMode: EngineCloneMode.Never
|
|
1037
|
+
});
|
|
1038
|
+
coreConfig.types.mailboxComponent ??= [];
|
|
1039
|
+
coreConfig.types.mailboxComponent.push({
|
|
1040
|
+
type: MailboxComponentType.Service,
|
|
1041
|
+
cloneMode: EngineCloneMode.Never
|
|
1042
|
+
});
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
894
1045
|
/**
|
|
895
1046
|
* Configures the faucet.
|
|
896
1047
|
* @param coreConfig The core config.
|
|
@@ -899,12 +1050,13 @@ async function configureMessaging(coreConfig, envVars) {
|
|
|
899
1050
|
*/
|
|
900
1051
|
async function configureFaucet(coreConfig, envVars) {
|
|
901
1052
|
coreConfig.types.faucetConnector ??= [];
|
|
902
|
-
|
|
1053
|
+
const faucetConnectorType = envChoice(envVars, "faucetConnector", Object.values(FaucetConnectorType));
|
|
1054
|
+
if (faucetConnectorType === FaucetConnectorType.EntityStorage) {
|
|
903
1055
|
coreConfig.types.faucetConnector.push({
|
|
904
1056
|
type: FaucetConnectorType.EntityStorage
|
|
905
1057
|
});
|
|
906
1058
|
}
|
|
907
|
-
else if (
|
|
1059
|
+
else if (faucetConnectorType === FaucetConnectorType.Iota &&
|
|
908
1060
|
Is.stringValue(envVars.iotaFaucetEndpoint)) {
|
|
909
1061
|
const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
|
|
910
1062
|
coreConfig.types.faucetConnector.push({
|
|
@@ -927,12 +1079,13 @@ async function configureFaucet(coreConfig, envVars) {
|
|
|
927
1079
|
*/
|
|
928
1080
|
async function configureWallet(coreConfig, envVars) {
|
|
929
1081
|
coreConfig.types.walletConnector ??= [];
|
|
930
|
-
|
|
1082
|
+
const walletConnectorType = envChoice(envVars, "walletConnector", Object.values(WalletConnectorType));
|
|
1083
|
+
if (walletConnectorType === WalletConnectorType.EntityStorage) {
|
|
931
1084
|
coreConfig.types.walletConnector.push({
|
|
932
1085
|
type: WalletConnectorType.EntityStorage
|
|
933
1086
|
});
|
|
934
1087
|
}
|
|
935
|
-
else if (
|
|
1088
|
+
else if (walletConnectorType === WalletConnectorType.Iota) {
|
|
936
1089
|
const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
|
|
937
1090
|
coreConfig.types.walletConnector.push({
|
|
938
1091
|
type: WalletConnectorType.Iota,
|
|
@@ -950,12 +1103,13 @@ async function configureWallet(coreConfig, envVars) {
|
|
|
950
1103
|
*/
|
|
951
1104
|
async function configureNft(coreConfig, envVars) {
|
|
952
1105
|
coreConfig.types.nftConnector ??= [];
|
|
953
|
-
|
|
1106
|
+
const nftConnectorType = envChoice(envVars, "nftConnector", Object.values(NftConnectorType));
|
|
1107
|
+
if (nftConnectorType === NftConnectorType.EntityStorage) {
|
|
954
1108
|
coreConfig.types.nftConnector.push({
|
|
955
1109
|
type: NftConnectorType.EntityStorage
|
|
956
1110
|
});
|
|
957
1111
|
}
|
|
958
|
-
else if (
|
|
1112
|
+
else if (nftConnectorType === NftConnectorType.Iota) {
|
|
959
1113
|
const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
|
|
960
1114
|
const config = {
|
|
961
1115
|
...dltConfig?.options?.config,
|
|
@@ -981,12 +1135,13 @@ async function configureNft(coreConfig, envVars) {
|
|
|
981
1135
|
*/
|
|
982
1136
|
async function configureNotarization(coreConfig, envVars) {
|
|
983
1137
|
coreConfig.types.notarizationConnector ??= [];
|
|
984
|
-
|
|
1138
|
+
const notarizationConnectorType = envChoice(envVars, "notarizationConnector", Object.values(NotarizationConnectorType));
|
|
1139
|
+
if (notarizationConnectorType === NotarizationConnectorType.EntityStorage) {
|
|
985
1140
|
coreConfig.types.notarizationConnector.push({
|
|
986
1141
|
type: NotarizationConnectorType.EntityStorage
|
|
987
1142
|
});
|
|
988
1143
|
}
|
|
989
|
-
else if (
|
|
1144
|
+
else if (notarizationConnectorType === NotarizationConnectorType.Iota) {
|
|
990
1145
|
const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
|
|
991
1146
|
coreConfig.types.notarizationConnector.push({
|
|
992
1147
|
type: NotarizationConnectorType.Iota,
|
|
@@ -1017,6 +1172,7 @@ async function configureImmutableProof(coreConfig, envVars) {
|
|
|
1017
1172
|
taskRetryCount: envCount(envVars, "immutableProofTaskRetryCount"),
|
|
1018
1173
|
taskRetryInterval: envSecToMs(envVars, "immutableProofTaskRetryInterval"),
|
|
1019
1174
|
taskFailureRetainFor: envMinToMs(envVars, "immutableProofTaskFailureRetainFor"),
|
|
1175
|
+
taskWorkerIdleTimeout: envSecToMs(envVars, "immutableProofTaskWorkerIdleTimeout"),
|
|
1020
1176
|
sweepIntervalMinutes: envMinutes(envVars, "immutableProofSweepInterval"),
|
|
1021
1177
|
sweepStaleThresholdMs: envMinToMs(envVars, "immutableProofSweepStaleThreshold"),
|
|
1022
1178
|
sweepMaxAttempts: envCount(envVars, "immutableProofSweepMaxAttempts"),
|
|
@@ -1036,12 +1192,13 @@ async function configureImmutableProof(coreConfig, envVars) {
|
|
|
1036
1192
|
*/
|
|
1037
1193
|
async function configureIdentity(coreConfig, envVars) {
|
|
1038
1194
|
coreConfig.types.identityConnector ??= [];
|
|
1039
|
-
|
|
1195
|
+
const identityConnectorType = envChoice(envVars, "identityConnector", Object.values(IdentityConnectorType));
|
|
1196
|
+
if (identityConnectorType === IdentityConnectorType.EntityStorage) {
|
|
1040
1197
|
coreConfig.types.identityConnector.push({
|
|
1041
1198
|
type: IdentityConnectorType.EntityStorage
|
|
1042
1199
|
});
|
|
1043
1200
|
}
|
|
1044
|
-
else if (
|
|
1201
|
+
else if (identityConnectorType === IdentityConnectorType.Iota) {
|
|
1045
1202
|
const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
|
|
1046
1203
|
coreConfig.types.identityConnector.push({
|
|
1047
1204
|
type: IdentityConnectorType.Iota,
|
|
@@ -1074,12 +1231,13 @@ async function configureIdentity(coreConfig, envVars) {
|
|
|
1074
1231
|
*/
|
|
1075
1232
|
async function configureIdentityResolver(coreConfig, envVars) {
|
|
1076
1233
|
coreConfig.types.identityResolverConnector ??= [];
|
|
1077
|
-
|
|
1234
|
+
const identityResolverConnectorType = envChoice(envVars, "identityResolverConnector", Object.values(IdentityResolverConnectorType));
|
|
1235
|
+
if (identityResolverConnectorType === IdentityResolverConnectorType.EntityStorage) {
|
|
1078
1236
|
coreConfig.types.identityResolverConnector.push({
|
|
1079
1237
|
type: IdentityResolverConnectorType.EntityStorage
|
|
1080
1238
|
});
|
|
1081
1239
|
}
|
|
1082
|
-
else if (
|
|
1240
|
+
else if (identityResolverConnectorType === IdentityResolverConnectorType.Iota) {
|
|
1083
1241
|
const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
|
|
1084
1242
|
coreConfig.types.identityResolverConnector.push({
|
|
1085
1243
|
type: IdentityResolverConnectorType.Iota,
|
|
@@ -1093,7 +1251,7 @@ async function configureIdentityResolver(coreConfig, envVars) {
|
|
|
1093
1251
|
}
|
|
1094
1252
|
});
|
|
1095
1253
|
}
|
|
1096
|
-
else if (
|
|
1254
|
+
else if (identityResolverConnectorType === IdentityResolverConnectorType.Universal) {
|
|
1097
1255
|
coreConfig.types.identityResolverConnector.push({
|
|
1098
1256
|
type: IdentityResolverConnectorType.Universal,
|
|
1099
1257
|
options: {
|
|
@@ -1118,7 +1276,8 @@ async function configureIdentityResolver(coreConfig, envVars) {
|
|
|
1118
1276
|
*/
|
|
1119
1277
|
async function configureIdentityProfile(coreConfig, envVars) {
|
|
1120
1278
|
coreConfig.types.identityProfileConnector ??= [];
|
|
1121
|
-
|
|
1279
|
+
const identityProfileConnectorType = envChoice(envVars, "identityProfileConnector", Object.values(IdentityProfileConnectorType));
|
|
1280
|
+
if (identityProfileConnectorType === IdentityProfileConnectorType.EntityStorage) {
|
|
1122
1281
|
coreConfig.types.identityProfileConnector.push({
|
|
1123
1282
|
type: IdentityProfileConnectorType.EntityStorage
|
|
1124
1283
|
});
|
|
@@ -1136,7 +1295,8 @@ async function configureIdentityProfile(coreConfig, envVars) {
|
|
|
1136
1295
|
*/
|
|
1137
1296
|
async function configureAttestation(coreConfig, envVars) {
|
|
1138
1297
|
coreConfig.types.attestationConnector ??= [];
|
|
1139
|
-
|
|
1298
|
+
const attestationConnectorType = envChoice(envVars, "attestationConnector", Object.values(AttestationConnectorType));
|
|
1299
|
+
if (attestationConnectorType === AttestationConnectorType.Nft) {
|
|
1140
1300
|
coreConfig.types.attestationConnector.push({
|
|
1141
1301
|
type: AttestationConnectorType.Nft
|
|
1142
1302
|
});
|
|
@@ -1198,23 +1358,24 @@ async function configureAuditableItemStream(coreConfig, envVars) {
|
|
|
1198
1358
|
* @returns A promise that resolves when the data processing configuration has been applied.
|
|
1199
1359
|
*/
|
|
1200
1360
|
async function configureDataProcessing(coreConfig, envVars) {
|
|
1201
|
-
|
|
1361
|
+
coreConfig.types.dataConverterConnector ??= [];
|
|
1362
|
+
const converterConnectors = envListToArray(envVars, "dataConverterConnectors", Object.values(DataConverterConnectorType));
|
|
1363
|
+
for (const converterConnector of converterConnectors) {
|
|
1364
|
+
coreConfig.types.dataConverterConnector.push({
|
|
1365
|
+
type: converterConnector
|
|
1366
|
+
});
|
|
1367
|
+
}
|
|
1368
|
+
coreConfig.types.dataExtractorConnector ??= [];
|
|
1369
|
+
const extractorConnectors = envListToArray(envVars, "dataExtractorConnectors", Object.values(DataExtractorConnectorType));
|
|
1370
|
+
for (const extractorConnector of extractorConnectors) {
|
|
1371
|
+
coreConfig.types.dataExtractorConnector.push({
|
|
1372
|
+
type: extractorConnector
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
if (coreConfig.types.dataConverterConnector.length > 0 ||
|
|
1376
|
+
coreConfig.types.dataExtractorConnector.length > 0) {
|
|
1202
1377
|
coreConfig.types.dataProcessingComponent ??= [];
|
|
1203
1378
|
coreConfig.types.dataProcessingComponent.push({ type: DataProcessingComponentType.Service });
|
|
1204
|
-
coreConfig.types.dataConverterConnector ??= [];
|
|
1205
|
-
const converterConnectors = commaSeparatedListToArray(envVars.dataConverterConnectors);
|
|
1206
|
-
for (const converterConnector of converterConnectors) {
|
|
1207
|
-
coreConfig.types.dataConverterConnector.push({
|
|
1208
|
-
type: converterConnector
|
|
1209
|
-
});
|
|
1210
|
-
}
|
|
1211
|
-
coreConfig.types.dataExtractorConnector ??= [];
|
|
1212
|
-
const extractorConnectors = commaSeparatedListToArray(envVars.dataExtractorConnectors);
|
|
1213
|
-
for (const extractorConnector of extractorConnectors) {
|
|
1214
|
-
coreConfig.types.dataExtractorConnector.push({
|
|
1215
|
-
type: extractorConnector
|
|
1216
|
-
});
|
|
1217
|
-
}
|
|
1218
1379
|
}
|
|
1219
1380
|
}
|
|
1220
1381
|
/**
|
|
@@ -1249,7 +1410,7 @@ async function configureTrust(coreConfig, envVars) {
|
|
|
1249
1410
|
type: TrustComponentType.Service
|
|
1250
1411
|
});
|
|
1251
1412
|
coreConfig.types.trustGeneratorComponent ??= [];
|
|
1252
|
-
const trustGeneratorTypes =
|
|
1413
|
+
const trustGeneratorTypes = envListToArray(envVars, "trustGenerators", Object.values(TrustGeneratorComponentType));
|
|
1253
1414
|
for (const trustGeneratorType of trustGeneratorTypes) {
|
|
1254
1415
|
coreConfig.types.trustGeneratorComponent.push({
|
|
1255
1416
|
type: trustGeneratorType,
|
|
@@ -1262,12 +1423,11 @@ async function configureTrust(coreConfig, envVars) {
|
|
|
1262
1423
|
});
|
|
1263
1424
|
}
|
|
1264
1425
|
coreConfig.types.trustVerifierComponent ??= [];
|
|
1265
|
-
const trustVerifierTypes =
|
|
1426
|
+
const trustVerifierTypes = envListToArray(envVars, "trustVerifiers", Object.values(TrustVerifierComponentType));
|
|
1266
1427
|
for (const trustVerifierType of trustVerifierTypes) {
|
|
1267
|
-
|
|
1268
|
-
if (type === TrustVerifierComponentType.IdentityAllowDeny) {
|
|
1428
|
+
if (trustVerifierType === TrustVerifierComponentType.IdentityAllowDeny) {
|
|
1269
1429
|
coreConfig.types.trustVerifierComponent.push({
|
|
1270
|
-
type,
|
|
1430
|
+
type: TrustVerifierComponentType.IdentityAllowDeny,
|
|
1271
1431
|
options: {
|
|
1272
1432
|
config: {
|
|
1273
1433
|
allowIdentities: commaSeparatedListToArray(envVars.trustIdentitiesAllow),
|
|
@@ -1276,9 +1436,9 @@ async function configureTrust(coreConfig, envVars) {
|
|
|
1276
1436
|
}
|
|
1277
1437
|
});
|
|
1278
1438
|
}
|
|
1279
|
-
else {
|
|
1439
|
+
else if (trustVerifierType === TrustVerifierComponentType.JwtVerifiableCredential) {
|
|
1280
1440
|
coreConfig.types.trustVerifierComponent.push({
|
|
1281
|
-
type
|
|
1441
|
+
type: TrustVerifierComponentType.JwtVerifiableCredential
|
|
1282
1442
|
});
|
|
1283
1443
|
}
|
|
1284
1444
|
}
|
|
@@ -1356,49 +1516,49 @@ async function configureRightsManagement(coreConfig, envVars) {
|
|
|
1356
1516
|
}
|
|
1357
1517
|
});
|
|
1358
1518
|
coreConfig.types.rightsManagementPolicyArbiterComponent ??= [];
|
|
1359
|
-
const policyArbiterTypes =
|
|
1519
|
+
const policyArbiterTypes = envListToArray(envVars, "rightsManagementPolicyArbiters", Object.values(RightsManagementPolicyArbiterComponentType));
|
|
1360
1520
|
for (const policyArbiterType of policyArbiterTypes) {
|
|
1361
1521
|
coreConfig.types.rightsManagementPolicyArbiterComponent.push({
|
|
1362
1522
|
type: policyArbiterType
|
|
1363
1523
|
});
|
|
1364
1524
|
}
|
|
1365
1525
|
coreConfig.types.rightsManagementPolicyObligationEnforcerComponent ??= [];
|
|
1366
|
-
const policyObligationEnforcerTypes =
|
|
1526
|
+
const policyObligationEnforcerTypes = envListToArray(envVars, "rightsManagementPolicyObligationEnforcers", Object.values(RightsManagementPolicyObligationEnforcerComponentType));
|
|
1367
1527
|
for (const policyObligationEnforcerType of policyObligationEnforcerTypes) {
|
|
1368
1528
|
coreConfig.types.rightsManagementPolicyObligationEnforcerComponent.push({
|
|
1369
1529
|
type: policyObligationEnforcerType
|
|
1370
1530
|
});
|
|
1371
1531
|
}
|
|
1372
1532
|
coreConfig.types.rightsManagementPolicyEnforcementProcessorComponent ??= [];
|
|
1373
|
-
const policyEnforcementProcessTypes =
|
|
1533
|
+
const policyEnforcementProcessTypes = envListToArray(envVars, "rightsManagementPolicyEnforcementProcessors", Object.values(RightsManagementPolicyEnforcementProcessorComponentType));
|
|
1374
1534
|
for (const policyEnforcementProcessorType of policyEnforcementProcessTypes) {
|
|
1375
1535
|
coreConfig.types.rightsManagementPolicyEnforcementProcessorComponent.push({
|
|
1376
1536
|
type: policyEnforcementProcessorType
|
|
1377
1537
|
});
|
|
1378
1538
|
}
|
|
1379
1539
|
coreConfig.types.rightsManagementPolicyExecutionActionComponent ??= [];
|
|
1380
|
-
const policyExecutionActionTypes =
|
|
1540
|
+
const policyExecutionActionTypes = envListToArray(envVars, "rightsManagementPolicyExecutionActions", Object.values(RightsManagementPolicyExecutionActionComponentType));
|
|
1381
1541
|
for (const policyExecutionActionType of policyExecutionActionTypes) {
|
|
1382
1542
|
coreConfig.types.rightsManagementPolicyExecutionActionComponent.push({
|
|
1383
1543
|
type: policyExecutionActionType
|
|
1384
1544
|
});
|
|
1385
1545
|
}
|
|
1386
1546
|
coreConfig.types.rightsManagementPolicyInformationSourceComponent ??= [];
|
|
1387
|
-
const policyInformationSourceTypes =
|
|
1547
|
+
const policyInformationSourceTypes = envListToArray(envVars, "rightsManagementPolicyInformationSources", Object.values(RightsManagementPolicyInformationSourceComponentType));
|
|
1388
1548
|
for (const policyInformationSourceType of policyInformationSourceTypes) {
|
|
1389
1549
|
coreConfig.types.rightsManagementPolicyInformationSourceComponent.push({
|
|
1390
1550
|
type: policyInformationSourceType
|
|
1391
1551
|
});
|
|
1392
1552
|
}
|
|
1393
1553
|
coreConfig.types.rightsManagementPolicyRequesterComponent ??= [];
|
|
1394
|
-
const policyRequesterTypes =
|
|
1554
|
+
const policyRequesterTypes = envListToArray(envVars, "rightsManagementPolicyRequesters", Object.values(RightsManagementPolicyRequesterComponentType));
|
|
1395
1555
|
for (const policyRequesterType of policyRequesterTypes) {
|
|
1396
1556
|
coreConfig.types.rightsManagementPolicyRequesterComponent.push({
|
|
1397
1557
|
type: policyRequesterType
|
|
1398
1558
|
});
|
|
1399
1559
|
}
|
|
1400
1560
|
coreConfig.types.rightsManagementPolicyNegotiatorComponent ??= [];
|
|
1401
|
-
const policyNegotiatorTypes =
|
|
1561
|
+
const policyNegotiatorTypes = envListToArray(envVars, "rightsManagementPolicyNegotiators", Object.values(RightsManagementPolicyNegotiatorComponentType));
|
|
1402
1562
|
for (const policyNegotiatorType of policyNegotiatorTypes) {
|
|
1403
1563
|
coreConfig.types.rightsManagementPolicyNegotiatorComponent.push({
|
|
1404
1564
|
type: policyNegotiatorType
|
|
@@ -1448,7 +1608,7 @@ async function configureFederatedCatalogue(coreConfig, envVars) {
|
|
|
1448
1608
|
}
|
|
1449
1609
|
});
|
|
1450
1610
|
coreConfig.types.federatedCatalogueFilterComponent ??= [];
|
|
1451
|
-
const filters =
|
|
1611
|
+
const filters = envListToArray(envVars, "federatedCatalogueFilters", Object.values(FederatedCatalogueFilterComponentType));
|
|
1452
1612
|
for (const filter of filters) {
|
|
1453
1613
|
coreConfig.types.federatedCatalogueFilterComponent.push({
|
|
1454
1614
|
type: filter,
|
|
@@ -1571,7 +1731,8 @@ export function isTrustRequired(envVars) {
|
|
|
1571
1731
|
export function isBackgroundTasksRequired(envVars) {
|
|
1572
1732
|
return (envBoolean(envVars, "dataspaceEnabled", false) ||
|
|
1573
1733
|
isImmutableProofRequired(envVars) ||
|
|
1574
|
-
envBoolean(envVars, "healthEnabled", false)
|
|
1734
|
+
envBoolean(envVars, "healthEnabled", false) ||
|
|
1735
|
+
commaSeparatedListToArray(envVars.telemetryConnector).includes(TelemetryConnectorType.EntityStorage));
|
|
1575
1736
|
}
|
|
1576
1737
|
/**
|
|
1577
1738
|
* Checks if the immutable proof subsystem is required.
|
|
@@ -1619,7 +1780,8 @@ export function isTaskSchedulerRequired(envVars) {
|
|
|
1619
1780
|
envBoolean(envVars, "dataspaceEnabled", false) ||
|
|
1620
1781
|
isRightsManagementRequired(envVars) ||
|
|
1621
1782
|
isAuthEntityStorageRequired(envVars) ||
|
|
1622
|
-
isImmutableProofRequired(envVars)
|
|
1783
|
+
isImmutableProofRequired(envVars) ||
|
|
1784
|
+
isMailboxEnabled(envVars));
|
|
1623
1785
|
}
|
|
1624
1786
|
/**
|
|
1625
1787
|
* Checks if the automation subsystem is required.
|
|
@@ -1646,6 +1808,20 @@ export function isTelemetryEnabled(envVars) {
|
|
|
1646
1808
|
* @returns True if tracing is enabled.
|
|
1647
1809
|
*/
|
|
1648
1810
|
export function isTracingEnabled(envVars) {
|
|
1649
|
-
return commaSeparatedListToArray(envVars.tracingConnector).some(t => t === TracingConnectorType.EntityStorage ||
|
|
1811
|
+
return commaSeparatedListToArray(envVars.tracingConnector).some(t => t === TracingConnectorType.EntityStorage ||
|
|
1812
|
+
t === TracingConnectorType.OpenTelemetry ||
|
|
1813
|
+
t === TracingConnectorType.Console);
|
|
1814
|
+
}
|
|
1815
|
+
/**
|
|
1816
|
+
* Checks if the mailbox subsystem is enabled.
|
|
1817
|
+
* Returns true when any component that depends on the mailbox subsystem is enabled.
|
|
1818
|
+
* @param envVars The environment variables.
|
|
1819
|
+
* @returns True if mailbox is enabled.
|
|
1820
|
+
*/
|
|
1821
|
+
export function isMailboxEnabled(envVars) {
|
|
1822
|
+
return commaSeparatedListToArray(envVars.emailProtocolConnector).some(t => t === EmailProtocolConnectorType.Imap ||
|
|
1823
|
+
t === EmailProtocolConnectorType.Pop3 ||
|
|
1824
|
+
t === EmailProtocolConnectorType.Gmail ||
|
|
1825
|
+
t === EmailProtocolConnectorType.Outlook);
|
|
1650
1826
|
}
|
|
1651
1827
|
//# sourceMappingURL=engineEnvBuilder.js.map
|