forked from robertopc1/data-api-builder
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathConfigureOptions.cs
More file actions
533 lines (436 loc) · 34.2 KB
/
Copy pathConfigureOptions.cs
File metadata and controls
533 lines (436 loc) · 34.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
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
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System.IO.Abstractions;
using Azure.DataApiBuilder.Config;
using Azure.DataApiBuilder.Config.ObjectModel;
using Azure.DataApiBuilder.Config.ObjectModel.Embeddings;
using Azure.DataApiBuilder.Product;
using Cli.Constants;
using CommandLine;
using Microsoft.Extensions.Logging;
using Serilog;
using static Cli.Utils;
using ILogger = Microsoft.Extensions.Logging.ILogger;
namespace Cli.Commands
{
/// <summary>
/// Configure command options
/// This command will be used to configure non-entity config properties.
/// </summary>
[Verb("configure", isDefault: false, HelpText = "Configure non-entity config properties", Hidden = false)]
public class ConfigureOptions : Options
{
public ConfigureOptions(
string? dataSourceDatabaseType = null,
string? dataSourceConnectionString = null,
string? dataSourceOptionsDatabase = null,
string? dataSourceOptionsContainer = null,
string? dataSourceOptionsSchema = null,
bool? dataSourceOptionsSetSessionContext = null,
string? dataSourceHealthName = null,
bool? dataSourceUserDelegatedAuthEnabled = null,
string? dataSourceUserDelegatedAuthDatabaseAudience = null,
string? dataSourceUserDelegatedAuthProvider = null,
bool? dataSourceHealthEnabled = null,
int? dataSourceHealthThresholdMs = null,
IEnumerable<string>? dataSourceFiles = null,
int? depthLimit = null,
bool? runtimeGraphQLEnabled = null,
string? runtimeGraphQLPath = null,
bool? runtimeGraphQLAllowIntrospection = null,
bool? runtimeGraphQLMultipleMutationsCreateEnabled = null,
bool? runtimeRestEnabled = null,
string? runtimeRestPath = null,
bool? runtimeRestRequestBodyStrict = null,
bool? runtimeMcpEnabled = null,
string? runtimeMcpPath = null,
string? runtimeMcpDescription = null,
bool? runtimeMcpDmlToolsEnabled = null,
bool? runtimeMcpDmlToolsDescribeEntitiesEnabled = null,
bool? runtimeMcpDmlToolsCreateRecordEnabled = null,
bool? runtimeMcpDmlToolsReadRecordsEnabled = null,
bool? runtimeMcpDmlToolsUpdateRecordEnabled = null,
bool? runtimeMcpDmlToolsDeleteRecordEnabled = null,
bool? runtimeMcpDmlToolsExecuteEntityEnabled = null,
bool? runtimeMcpDmlToolsAggregateRecordsEnabled = null,
int? runtimeMcpDmlToolsAggregateRecordsQueryTimeout = null,
bool? runtimeCacheEnabled = null,
int? runtimeCacheTtl = null,
int? runtimePaginationMaxPageSize = null,
int? runtimePaginationDefaultPageSize = null,
bool? runtimePaginationNextLinkRelative = null,
CompressionLevel? runtimeCompressionLevel = null,
bool? runtimeHealthEnabled = null,
int? runtimeHealthCacheTtlSeconds = null,
int? runtimeHealthMaxQueryParallelism = null,
IEnumerable<string>? runtimeHealthRoles = null,
HostMode? runtimeHostMode = null,
IEnumerable<string>? runtimeHostCorsOrigins = null,
bool? runtimeHostCorsAllowCredentials = null,
string? runtimeHostAuthenticationProvider = null,
string? runtimeHostAuthenticationJwtAudience = null,
string? runtimeHostAuthenticationJwtIssuer = null,
int? runtimeHostMaxResponseSizeMb = null,
string? azureKeyVaultEndpoint = null,
AKVRetryPolicyMode? azureKeyVaultRetryPolicyMode = null,
int? azureKeyVaultRetryPolicyMaxCount = null,
int? azureKeyVaultRetryPolicyDelaySeconds = null,
int? azureKeyVaultRetryPolicyMaxDelaySeconds = null,
int? azureKeyVaultRetryPolicyNetworkTimeoutSeconds = null,
CliBool? azureLogAnalyticsEnabled = null,
string? azureLogAnalyticsDabIdentifier = null,
int? azureLogAnalyticsFlushIntervalSeconds = null,
string? azureLogAnalyticsCustomTableName = null,
string? azureLogAnalyticsDcrImmutableId = null,
string? azureLogAnalyticsDceEndpoint = null,
CliBool? fileSinkEnabled = null,
string? fileSinkPath = null,
RollingInterval? fileSinkRollingInterval = null,
int? fileSinkRetainedFileCountLimit = null,
long? fileSinkFileSizeLimitBytes = null,
IEnumerable<string>? runtimeTelemetryLogLevel = null,
bool showEffectivePermissions = false,
CliBool? runtimeEmbeddingsEnabled = null,
EmbeddingProviderType? runtimeEmbeddingsProvider = null,
string? runtimeEmbeddingsBaseUrl = null,
string? runtimeEmbeddingsApiKey = null,
string? runtimeEmbeddingsModel = null,
string? runtimeEmbeddingsApiVersion = null,
int? runtimeEmbeddingsDimensions = null,
int? runtimeEmbeddingsTimeoutMs = null,
CliBool? runtimeEmbeddingsEndpointEnabled = null,
IEnumerable<string>? runtimeEmbeddingsEndpointRoles = null,
string? runtimeEmbeddingsEndpointPath = null,
CliBool? runtimeEmbeddingsHealthEnabled = null,
int? runtimeEmbeddingsHealthThresholdMs = null,
string? runtimeEmbeddingsHealthTestText = null,
int? runtimeEmbeddingsHealthExpectedDimensions = null,
CliBool? runtimeEmbeddingsChunkingEnabled = null,
int? runtimeEmbeddingsChunkingSizeChars = null,
int? runtimeEmbeddingsChunkingOverlapChars = null,
CliBool? runtimeEmbeddingsCacheEnabled = null,
int? runtimeEmbeddingsCacheTtlHours = null,
CliBool? runtimeEmbeddingsCacheLevel2Enabled = null,
string? runtimeEmbeddingsCacheLevel2ConnectionString = null,
string? config = null)
: base(config)
{
// Data Source
DataSourceDatabaseType = dataSourceDatabaseType;
DataSourceConnectionString = dataSourceConnectionString;
DataSourceOptionsDatabase = dataSourceOptionsDatabase;
DataSourceOptionsContainer = dataSourceOptionsContainer;
DataSourceOptionsSchema = dataSourceOptionsSchema;
DataSourceOptionsSetSessionContext = dataSourceOptionsSetSessionContext;
DataSourceHealthName = dataSourceHealthName;
DataSourceUserDelegatedAuthEnabled = dataSourceUserDelegatedAuthEnabled;
DataSourceUserDelegatedAuthDatabaseAudience = dataSourceUserDelegatedAuthDatabaseAudience;
DataSourceUserDelegatedAuthProvider = dataSourceUserDelegatedAuthProvider;
DataSourceHealthEnabled = dataSourceHealthEnabled;
DataSourceHealthThresholdMs = dataSourceHealthThresholdMs;
DataSourceFiles = dataSourceFiles;
// GraphQL
DepthLimit = depthLimit;
RuntimeGraphQLEnabled = runtimeGraphQLEnabled;
RuntimeGraphQLPath = runtimeGraphQLPath;
RuntimeGraphQLAllowIntrospection = runtimeGraphQLAllowIntrospection;
RuntimeGraphQLMultipleMutationsCreateEnabled = runtimeGraphQLMultipleMutationsCreateEnabled;
// Rest
RuntimeRestEnabled = runtimeRestEnabled;
RuntimeRestPath = runtimeRestPath;
RuntimeRestRequestBodyStrict = runtimeRestRequestBodyStrict;
// Mcp
RuntimeMcpEnabled = runtimeMcpEnabled;
RuntimeMcpPath = runtimeMcpPath;
RuntimeMcpDescription = runtimeMcpDescription;
RuntimeMcpDmlToolsEnabled = runtimeMcpDmlToolsEnabled;
RuntimeMcpDmlToolsDescribeEntitiesEnabled = runtimeMcpDmlToolsDescribeEntitiesEnabled;
RuntimeMcpDmlToolsCreateRecordEnabled = runtimeMcpDmlToolsCreateRecordEnabled;
RuntimeMcpDmlToolsReadRecordsEnabled = runtimeMcpDmlToolsReadRecordsEnabled;
RuntimeMcpDmlToolsUpdateRecordEnabled = runtimeMcpDmlToolsUpdateRecordEnabled;
RuntimeMcpDmlToolsDeleteRecordEnabled = runtimeMcpDmlToolsDeleteRecordEnabled;
RuntimeMcpDmlToolsExecuteEntityEnabled = runtimeMcpDmlToolsExecuteEntityEnabled;
RuntimeMcpDmlToolsAggregateRecordsEnabled = runtimeMcpDmlToolsAggregateRecordsEnabled;
RuntimeMcpDmlToolsAggregateRecordsQueryTimeout = runtimeMcpDmlToolsAggregateRecordsQueryTimeout;
// Cache
RuntimeCacheEnabled = runtimeCacheEnabled;
RuntimeCacheTTL = runtimeCacheTtl;
// Pagination
RuntimePaginationMaxPageSize = runtimePaginationMaxPageSize;
RuntimePaginationDefaultPageSize = runtimePaginationDefaultPageSize;
RuntimePaginationNextLinkRelative = runtimePaginationNextLinkRelative;
// Compression
RuntimeCompressionLevel = runtimeCompressionLevel;
// Health
RuntimeHealthEnabled = runtimeHealthEnabled;
RuntimeHealthCacheTtlSeconds = runtimeHealthCacheTtlSeconds;
RuntimeHealthMaxQueryParallelism = runtimeHealthMaxQueryParallelism;
RuntimeHealthRoles = runtimeHealthRoles;
// Host
RuntimeHostMode = runtimeHostMode;
RuntimeHostCorsOrigins = runtimeHostCorsOrigins;
RuntimeHostCorsAllowCredentials = runtimeHostCorsAllowCredentials;
RuntimeHostAuthenticationProvider = runtimeHostAuthenticationProvider;
RuntimeHostAuthenticationJwtAudience = runtimeHostAuthenticationJwtAudience;
RuntimeHostAuthenticationJwtIssuer = runtimeHostAuthenticationJwtIssuer;
RuntimeHostMaxResponseSizeMb = runtimeHostMaxResponseSizeMb;
// Azure Key Vault
AzureKeyVaultEndpoint = azureKeyVaultEndpoint;
AzureKeyVaultRetryPolicyMode = azureKeyVaultRetryPolicyMode;
AzureKeyVaultRetryPolicyMaxCount = azureKeyVaultRetryPolicyMaxCount;
AzureKeyVaultRetryPolicyDelaySeconds = azureKeyVaultRetryPolicyDelaySeconds;
AzureKeyVaultRetryPolicyMaxDelaySeconds = azureKeyVaultRetryPolicyMaxDelaySeconds;
AzureKeyVaultRetryPolicyNetworkTimeoutSeconds = azureKeyVaultRetryPolicyNetworkTimeoutSeconds;
// Azure Log Analytics
AzureLogAnalyticsEnabled = azureLogAnalyticsEnabled;
AzureLogAnalyticsDabIdentifier = azureLogAnalyticsDabIdentifier;
AzureLogAnalyticsFlushIntervalSeconds = azureLogAnalyticsFlushIntervalSeconds;
AzureLogAnalyticsCustomTableName = azureLogAnalyticsCustomTableName;
AzureLogAnalyticsDcrImmutableId = azureLogAnalyticsDcrImmutableId;
AzureLogAnalyticsDceEndpoint = azureLogAnalyticsDceEndpoint;
// File
FileSinkEnabled = fileSinkEnabled;
FileSinkPath = fileSinkPath;
FileSinkRollingInterval = fileSinkRollingInterval;
FileSinkRetainedFileCountLimit = fileSinkRetainedFileCountLimit;
FileSinkFileSizeLimitBytes = fileSinkFileSizeLimitBytes;
// Telemetry Log Level
RuntimeTelemetryLogLevel = runtimeTelemetryLogLevel;
ShowEffectivePermissions = showEffectivePermissions;
// Embeddings
RuntimeEmbeddingsEnabled = runtimeEmbeddingsEnabled;
RuntimeEmbeddingsProvider = runtimeEmbeddingsProvider;
RuntimeEmbeddingsBaseUrl = runtimeEmbeddingsBaseUrl;
RuntimeEmbeddingsApiKey = runtimeEmbeddingsApiKey;
RuntimeEmbeddingsModel = runtimeEmbeddingsModel;
RuntimeEmbeddingsApiVersion = runtimeEmbeddingsApiVersion;
RuntimeEmbeddingsDimensions = runtimeEmbeddingsDimensions;
RuntimeEmbeddingsTimeoutMs = runtimeEmbeddingsTimeoutMs;
// Embeddings Endpoint
RuntimeEmbeddingsEndpointEnabled = runtimeEmbeddingsEndpointEnabled;
RuntimeEmbeddingsEndpointRoles = runtimeEmbeddingsEndpointRoles;
RuntimeEmbeddingsEndpointPath = runtimeEmbeddingsEndpointPath;
// Embeddings Health
RuntimeEmbeddingsHealthEnabled = runtimeEmbeddingsHealthEnabled;
RuntimeEmbeddingsHealthThresholdMs = runtimeEmbeddingsHealthThresholdMs;
RuntimeEmbeddingsHealthTestText = runtimeEmbeddingsHealthTestText;
RuntimeEmbeddingsHealthExpectedDimensions = runtimeEmbeddingsHealthExpectedDimensions;
// Embeddings Chunking
RuntimeEmbeddingsChunkingEnabled = runtimeEmbeddingsChunkingEnabled;
RuntimeEmbeddingsChunkingSizeChars = runtimeEmbeddingsChunkingSizeChars;
RuntimeEmbeddingsChunkingOverlapChars = runtimeEmbeddingsChunkingOverlapChars;
// Embeddings Cache
RuntimeEmbeddingsCacheEnabled = runtimeEmbeddingsCacheEnabled;
RuntimeEmbeddingsCacheTtlHours = runtimeEmbeddingsCacheTtlHours;
RuntimeEmbeddingsCacheLevel2Enabled = runtimeEmbeddingsCacheLevel2Enabled;
RuntimeEmbeddingsCacheLevel2ConnectionString = runtimeEmbeddingsCacheLevel2ConnectionString;
}
[Option("data-source.database-type", Required = false, HelpText = "Database type. Allowed values: mssql, postgresql, cosmosdb_nosql, mysql, dwsql.")]
public string? DataSourceDatabaseType { get; }
[Option("data-source.connection-string", Required = false, HelpText = "Connection string for the data source.")]
public string? DataSourceConnectionString { get; }
[Option("data-source.options.database", Required = false, HelpText = "Database name for Cosmos DB for NoSql.")]
public string? DataSourceOptionsDatabase { get; }
[Option("data-source.options.container", Required = false, HelpText = "Container name for Cosmos DB for NoSql.")]
public string? DataSourceOptionsContainer { get; }
[Option("data-source.options.schema", Required = false, HelpText = "Schema path for Cosmos DB for NoSql.")]
public string? DataSourceOptionsSchema { get; }
[Option("data-source.options.set-session-context", Required = false, HelpText = "Enable session context. Allowed values: true, false.")]
public bool? DataSourceOptionsSetSessionContext { get; }
[Option("data-source.health.name", Required = false, HelpText = "Identifier for data source in health check report.")]
public string? DataSourceHealthName { get; }
[Option("data-source.user-delegated-auth.enabled", Required = false, HelpText = "Enable user-delegated authentication (OBO) for Azure SQL and SQL Server. Default: false (boolean).")]
public bool? DataSourceUserDelegatedAuthEnabled { get; }
[Option("data-source.user-delegated-auth.database-audience", Required = false, HelpText = "Database resource identifier for token acquisition (e.g., https://database.windows.net for Azure SQL).")]
public string? DataSourceUserDelegatedAuthDatabaseAudience { get; }
[Option("data-source.user-delegated-auth.provider", Required = false, HelpText = "Authentication provider for user-delegated auth. Allowed values: EntraId. Default: EntraId.")]
public string? DataSourceUserDelegatedAuthProvider { get; }
[Option("data-source.health.enabled", Required = false, HelpText = "Enable health check for this data source. Default: true (boolean).")]
public bool? DataSourceHealthEnabled { get; }
[Option("data-source.health.threshold-ms", Required = false, HelpText = "Health check response time threshold in milliseconds. Default: 1000. Range: 1-2147483647.")]
public int? DataSourceHealthThresholdMs { get; }
[Option("data-source-files", Required = false, Separator = ',', HelpText = "Comma-separated list of additional runtime config files for multi-database scenarios.")]
public IEnumerable<string>? DataSourceFiles { get; }
[Option("runtime.graphql.depth-limit", Required = false, HelpText = "Max allowed depth of a nested query. Allowed values: 1-2147483647, or -1 to remove a previously set limit. Default: -1.")]
public int? DepthLimit { get; }
[Option("runtime.graphql.enabled", Required = false, HelpText = "Enable DAB's GraphQL endpoint. Default: true (boolean).")]
public bool? RuntimeGraphQLEnabled { get; }
[Option("runtime.graphql.path", Required = false, HelpText = "Customize DAB's GraphQL endpoint path. Allowed values: string. Conditions: Prefix with '/', no spaces and no reserved characters.")]
public string? RuntimeGraphQLPath { get; }
[Option("runtime.graphql.allow-introspection", Required = false, HelpText = "Allow/Deny GraphQL introspection requests in GraphQL Schema. Default: true (boolean).")]
public bool? RuntimeGraphQLAllowIntrospection { get; }
[Option("runtime.graphql.multiple-mutations.create.enabled", Required = false, HelpText = "Enable/Disable multiple-mutation create operations on DAB's generated GraphQL schema. Default: false (boolean).")]
public bool? RuntimeGraphQLMultipleMutationsCreateEnabled { get; }
[Option("runtime.rest.enabled", Required = false, HelpText = "Enable DAB's Rest endpoint. Default: true (boolean).")]
public bool? RuntimeRestEnabled { get; }
[Option("runtime.rest.path", Required = false, HelpText = "Customize DAB's REST endpoint path. Default: '/api' Conditions: Prefix path with '/'.")]
public string? RuntimeRestPath { get; }
[Option("runtime.rest.request-body-strict", Required = false, HelpText = "Prohibit extraneous REST request body fields. Default: false (boolean).")]
public bool? RuntimeRestRequestBodyStrict { get; }
[Option("runtime.mcp.enabled", Required = false, HelpText = "Enable DAB's MCP endpoint. Default: true (boolean).")]
public bool? RuntimeMcpEnabled { get; }
[Option("runtime.mcp.path", Required = false, HelpText = "Customize DAB's MCP endpoint path. Default: '/mcp' Conditions: Prefix path with '/'.")]
public string? RuntimeMcpPath { get; }
[Option("runtime.mcp.description", Required = false, HelpText = "Set the MCP server description to be exposed in the initialize response.")]
public string? RuntimeMcpDescription { get; }
[Option("runtime.mcp.dml-tools.enabled", Required = false, HelpText = "Enable DAB's MCP DML tools endpoint. Default: true (boolean).")]
public bool? RuntimeMcpDmlToolsEnabled { get; }
[Option("runtime.mcp.dml-tools.describe-entities", Required = false, HelpText = "Enable DAB's MCP describe entities tool. Default: true (boolean).")]
public bool? RuntimeMcpDmlToolsDescribeEntitiesEnabled { get; }
[Option("runtime.mcp.dml-tools.create-record", Required = false, HelpText = "Enable DAB's MCP create record tool. Default: true (boolean).")]
public bool? RuntimeMcpDmlToolsCreateRecordEnabled { get; }
[Option("runtime.mcp.dml-tools.read-records", Required = false, HelpText = "Enable DAB's MCP read record tool. Default: true (boolean).")]
public bool? RuntimeMcpDmlToolsReadRecordsEnabled { get; }
[Option("runtime.mcp.dml-tools.update-record", Required = false, HelpText = "Enable DAB's MCP update record tool. Default: true (boolean).")]
public bool? RuntimeMcpDmlToolsUpdateRecordEnabled { get; }
[Option("runtime.mcp.dml-tools.delete-record", Required = false, HelpText = "Enable DAB's MCP delete record tool. Default: true (boolean).")]
public bool? RuntimeMcpDmlToolsDeleteRecordEnabled { get; }
[Option("runtime.mcp.dml-tools.execute-entity", Required = false, HelpText = "Enable DAB's MCP execute entity tool. Default: true (boolean).")]
public bool? RuntimeMcpDmlToolsExecuteEntityEnabled { get; }
[Option("runtime.mcp.dml-tools.aggregate-records", Required = false, HelpText = "Enable DAB's MCP aggregate records tool. Default: true (boolean).")]
public bool? RuntimeMcpDmlToolsAggregateRecordsEnabled { get; }
[Option("runtime.mcp.dml-tools.aggregate-records.query-timeout", Required = false, HelpText = "Set the execution timeout in seconds for the aggregate-records MCP tool. Default: 30 (integer). Range: 1-600.")]
public int? RuntimeMcpDmlToolsAggregateRecordsQueryTimeout { get; }
[Option("runtime.cache.enabled", Required = false, HelpText = "Enable DAB's cache globally. (You must also enable each entity's cache separately.). Default: false (boolean).")]
public bool? RuntimeCacheEnabled { get; }
[Option("runtime.cache.ttl-seconds", Required = false, HelpText = "Customize the DAB cache's global default time to live in seconds. Default: 5 seconds (Integer).")]
public int? RuntimeCacheTTL { get; }
[Option("runtime.pagination.max-page-size", Required = false, HelpText = "Maximum page size for paginated results. Default: 100000. Minimum: 1.")]
public int? RuntimePaginationMaxPageSize { get; }
[Option("runtime.pagination.default-page-size", Required = false, HelpText = "Default page size for paginated results. Default: 100. Minimum: 1.")]
public int? RuntimePaginationDefaultPageSize { get; }
[Option("runtime.pagination.next-link-relative", Required = false, HelpText = "Use relative URLs for pagination next links. Default: false (boolean).")]
public bool? RuntimePaginationNextLinkRelative { get; }
[Option("runtime.compression.level", Required = false, HelpText = "Set the response compression level. Allowed values: optimal (default), fastest, none.")]
public CompressionLevel? RuntimeCompressionLevel { get; }
[Option("runtime.health.enabled", Required = false, HelpText = "Enable runtime health checks. Default: true (boolean).")]
public bool? RuntimeHealthEnabled { get; }
[Option("runtime.health.cache-ttl-seconds", Required = false, HelpText = "Time to live in seconds for cached health check results. Default: 5.")]
public int? RuntimeHealthCacheTtlSeconds { get; }
[Option("runtime.health.max-query-parallelism", Required = false, HelpText = "Maximum number of parallel health check queries. Default: 4. Range: 1-8.")]
public int? RuntimeHealthMaxQueryParallelism { get; }
[Option("runtime.health.roles", Required = false, Separator = ',', HelpText = "Comma-separated list of roles allowed to access health check details.")]
public IEnumerable<string>? RuntimeHealthRoles { get; }
[Option("runtime.host.mode", Required = false, HelpText = "Set the host running mode of DAB in Development or Production. Default: Production.")]
public HostMode? RuntimeHostMode { get; }
[Option("runtime.host.cors.origins", Required = false, HelpText = "Overwrite Allowed Origins in CORS. Default: [] (Space separated array of strings).")]
public IEnumerable<string>? RuntimeHostCorsOrigins { get; }
[Option("runtime.host.cors.allow-credentials", Required = false, HelpText = "Set value for Access-Control-Allow-Credentials header in Host.Cors. Default: false (boolean).")]
public bool? RuntimeHostCorsAllowCredentials { get; }
[Option("runtime.host.authentication.provider", Required = false, HelpText = "Configure the name of authentication provider. Default: Unauthenticated.")]
public string? RuntimeHostAuthenticationProvider { get; }
[Option("runtime.host.authentication.jwt.audience", Required = false, HelpText = "Configure the intended recipient(s) of the Jwt Token.")]
public string? RuntimeHostAuthenticationJwtAudience { get; }
[Option("runtime.host.authentication.jwt.issuer", Required = false, HelpText = "Configure the entity that issued the Jwt Token.")]
public string? RuntimeHostAuthenticationJwtIssuer { get; }
[Option("runtime.host.max-response-size-mb", Required = false, HelpText = "Maximum response size in megabytes. Use -1 for maximum engine limit. Default: 158.")]
public int? RuntimeHostMaxResponseSizeMb { get; }
[Option("azure-key-vault.endpoint", Required = false, HelpText = "Configure the Azure Key Vault endpoint URL.")]
public string? AzureKeyVaultEndpoint { get; }
[Option("azure-key-vault.retry-policy.mode", Required = false, HelpText = "Configure the retry policy mode. Allowed values: fixed, exponential. Default: exponential.")]
public AKVRetryPolicyMode? AzureKeyVaultRetryPolicyMode { get; }
[Option("azure-key-vault.retry-policy.max-count", Required = false, HelpText = "Configure the maximum number of retry attempts. Default: 3.")]
public int? AzureKeyVaultRetryPolicyMaxCount { get; }
[Option("azure-key-vault.retry-policy.delay-seconds", Required = false, HelpText = "Configure the initial delay between retries in seconds. Default: 1.")]
public int? AzureKeyVaultRetryPolicyDelaySeconds { get; }
[Option("azure-key-vault.retry-policy.max-delay-seconds", Required = false, HelpText = "Configure the maximum delay between retries in seconds (for exponential mode). Default: 60.")]
public int? AzureKeyVaultRetryPolicyMaxDelaySeconds { get; }
[Option("azure-key-vault.retry-policy.network-timeout-seconds", Required = false, HelpText = "Configure the network timeout for requests in seconds. Default: 60.")]
public int? AzureKeyVaultRetryPolicyNetworkTimeoutSeconds { get; }
[Option("runtime.telemetry.azure-log-analytics.enabled", Required = false, HelpText = "Enable/Disable Azure Log Analytics. Default: False (boolean)")]
public CliBool? AzureLogAnalyticsEnabled { get; }
[Option("runtime.telemetry.azure-log-analytics.dab-identifier", Required = false, HelpText = "Configure DAB Identifier to allow user to differentiate which logs come from DAB in Azure Log Analytics . Default: DABLogs")]
public string? AzureLogAnalyticsDabIdentifier { get; }
[Option("runtime.telemetry.azure-log-analytics.flush-interval-seconds", Required = false, HelpText = "Configure Flush Interval in seconds for Azure Log Analytics to specify the time interval to send the telemetry data. Default: 5")]
public int? AzureLogAnalyticsFlushIntervalSeconds { get; }
[Option("runtime.telemetry.azure-log-analytics.auth.custom-table-name", Required = false, HelpText = "Configure Custom Table Name for Azure Log Analytics used to find table to connect")]
public string? AzureLogAnalyticsCustomTableName { get; }
[Option("runtime.telemetry.azure-log-analytics.auth.dcr-immutable-id", Required = false, HelpText = "Configure DCR Immutable ID for Azure Log Analytics to find the data collection rule that defines how data is collected")]
public string? AzureLogAnalyticsDcrImmutableId { get; }
[Option("runtime.telemetry.azure-log-analytics.auth.dce-endpoint", Required = false, HelpText = "Configure DCE Endpoint for Azure Log Analytics to find table to send telemetry data")]
public string? AzureLogAnalyticsDceEndpoint { get; }
[Option("runtime.telemetry.file.enabled", Required = false, HelpText = "Enable/Disable File Sink logging. Default: False (boolean)")]
public CliBool? FileSinkEnabled { get; }
[Option("runtime.telemetry.file.path", Required = false, HelpText = "Configure path for File Sink logging. Default: /logs/dab-log.txt")]
public string? FileSinkPath { get; }
[Option("runtime.telemetry.file.rolling-interval", Required = false, HelpText = "Configure rolling interval for File Sink logging. Default: Day")]
public RollingInterval? FileSinkRollingInterval { get; }
[Option("runtime.telemetry.file.retained-file-count-limit", Required = false, HelpText = "Configure maximum number of retained files. Default: 1")]
public int? FileSinkRetainedFileCountLimit { get; }
[Option("runtime.telemetry.file.file-size-limit-bytes", Required = false, HelpText = "Configure maximum file size limit in bytes. Default: 1048576")]
public long? FileSinkFileSizeLimitBytes { get; }
[Option("runtime.telemetry.log-level", Required = false, Separator = ',', HelpText = "Configure log levels by namespace. Format: 'Namespace:Level,...'. Allowed levels: trace, debug, information, warning, error, critical, none.")]
public IEnumerable<string>? RuntimeTelemetryLogLevel { get; }
[Option("show-effective-permissions", Required = false, HelpText = "Display effective permissions for all entities, including inherited permissions. Entities are listed in alphabetical order.")]
public bool ShowEffectivePermissions { get; }
[Option("runtime.embeddings.enabled", Required = false, HelpText = "Enable/disable the embedding service. Default: true")]
public CliBool? RuntimeEmbeddingsEnabled { get; }
[Option("runtime.embeddings.provider", Required = false, HelpText = "Configure embedding provider type. Allowed values: azure-openai, openai.")]
public EmbeddingProviderType? RuntimeEmbeddingsProvider { get; }
[Option("runtime.embeddings.base-url", Required = false, HelpText = "Configure the embedding provider base URL.")]
public string? RuntimeEmbeddingsBaseUrl { get; }
[Option("runtime.embeddings.api-key", Required = false, HelpText = "Configure the embedding API key for authentication.")]
public string? RuntimeEmbeddingsApiKey { get; }
[Option("runtime.embeddings.model", Required = false, HelpText = "Configure the model/deployment name. Required for Azure OpenAI, defaults to text-embedding-3-small for OpenAI.")]
public string? RuntimeEmbeddingsModel { get; }
[Option("runtime.embeddings.api-version", Required = false, HelpText = "Configure the Azure API version. Only used for Azure OpenAI provider. Default: 2024-02-01")]
public string? RuntimeEmbeddingsApiVersion { get; }
[Option("runtime.embeddings.dimensions", Required = false, HelpText = "Configure the output vector dimensions. Optional, uses model default if not specified.")]
public int? RuntimeEmbeddingsDimensions { get; }
[Option("runtime.embeddings.timeout-ms", Required = false, HelpText = "Configure the request timeout in milliseconds. Default: 30000")]
public int? RuntimeEmbeddingsTimeoutMs { get; }
[Option("runtime.embeddings.endpoint.enabled", Required = false, HelpText = "Enable/disable the endpoint for embeddings. Default: false")]
public CliBool? RuntimeEmbeddingsEndpointEnabled { get; }
[Option("runtime.embeddings.endpoint.roles", Required = false, Separator = ',', HelpText = "Configure the roles allowed to access the embedding endpoint. Comma-separated list. In development mode defaults to 'anonymous'.")]
public IEnumerable<string>? RuntimeEmbeddingsEndpointRoles { get; }
[Option("runtime.embeddings.endpoint.path", Required = false, HelpText = "Configure the URL path for the embedding endpoint. Default: '/embed' Conditions: Prefix path with '/'.")]
public string? RuntimeEmbeddingsEndpointPath { get; }
[Option("runtime.embeddings.health.enabled", Required = false, HelpText = "Enable/disable health checks for the embedding service. Default: true")]
public CliBool? RuntimeEmbeddingsHealthEnabled { get; }
[Option("runtime.embeddings.health.threshold-ms", Required = false, HelpText = "Configure the health check threshold in milliseconds. Default: 5000")]
public int? RuntimeEmbeddingsHealthThresholdMs { get; }
[Option("runtime.embeddings.health.test-text", Required = false, HelpText = "Configure the test text for health check validation. Default: 'health check'")]
public string? RuntimeEmbeddingsHealthTestText { get; }
[Option("runtime.embeddings.health.expected-dimensions", Required = false, HelpText = "Configure the expected dimensions for health check validation. Optional.")]
public int? RuntimeEmbeddingsHealthExpectedDimensions { get; }
[Option("runtime.embeddings.chunking.enabled", Required = false, HelpText = "Enable/disable text chunking before embedding. Default: true")]
public CliBool? RuntimeEmbeddingsChunkingEnabled { get; }
[Option("runtime.embeddings.chunking.size-chars", Required = false, HelpText = "Configure the chunk size in characters. Default: 800")]
public int? RuntimeEmbeddingsChunkingSizeChars { get; }
[Option("runtime.embeddings.chunking.overlap-chars", Required = false, HelpText = "Configure the overlap size in characters between consecutive chunks. Default: 100")]
public int? RuntimeEmbeddingsChunkingOverlapChars { get; }
[Option("runtime.embeddings.cache.enabled", Required = false, HelpText = "Enable/disable caching for embeddings. Default: true")]
public CliBool? RuntimeEmbeddingsCacheEnabled { get; }
[Option("runtime.embeddings.cache.ttl-hours", Required = false, HelpText = "Configure the time-to-live for cached embeddings in hours. Default: 24")]
public int? RuntimeEmbeddingsCacheTtlHours { get; }
[Option("runtime.embeddings.cache.level-2.enabled", Required = false, HelpText = "Enable/disable the L2 (distributed Azure Managed Redis) cache for embeddings. Default: false")]
public CliBool? RuntimeEmbeddingsCacheLevel2Enabled { get; }
[Option("runtime.embeddings.cache.level-2.connection-string", Required = false, HelpText = "Connection string for the L2 (Azure Managed Redis) cache used by embeddings.")]
public string? RuntimeEmbeddingsCacheLevel2ConnectionString { get; }
public int Handler(ILogger logger, FileSystemRuntimeConfigLoader loader, IFileSystem fileSystem)
{
logger.LogInformation("{productName} {version}", PRODUCT_NAME, ProductInfo.GetProductVersion());
if (ShowEffectivePermissions)
{
bool isSuccess = ConfigGenerator.TryShowEffectivePermissions(this, loader, fileSystem);
if (!isSuccess)
{
logger.LogError("Failed to display effective permissions.");
return CliReturnCode.GENERAL_ERROR;
}
return CliReturnCode.SUCCESS;
}
bool configSuccess = ConfigGenerator.TryConfigureSettings(this, loader, fileSystem);
if (configSuccess)
{
logger.LogInformation("Successfully updated runtime settings in the config file.");
return CliReturnCode.SUCCESS;
}
else
{
logger.LogError("Failed to update runtime settings in the config file.");
return CliReturnCode.GENERAL_ERROR;
}
}
}
}