The dab configure command is designed to simplify updating config properties outside of the entities section. This document outlines the design, functionality, and implementation details of the dab configure command.
-
Add support to CLI to configure the
data-sourceandruntimesections of the runtime config. -
Ensure configurations are validated before being applied.
dab configure [options]
Some Example of the options that we currently support:
--config: Specify the configuration file path.--runtime.graphql.depth-limit: Max allowed depth of the nested query.--data-source.database-type: Type of database to connect to.--data-source.options.schema: Schema path for Cosmos DB for NoSql.--help: Display help information about the command.
NOTE: The goal is to make all the properties under the runtime and data-source section configurable via configure command.
The configuration file consists of three main sections:
- data-source: Defines the database connection and options.
- runtime: Configures the runtime settings for REST, GraphQL, and host settings.
- entities: Entity related information.
dab configure is only for updating the data-source and runtime sections of the config. For the entities section, we already have the dab update command.
- Identify the section to configure.
data-sourceorruntime. - Identify the property in that section to update.
- '.' is used for nesting.
Example:
{
"data-source": {
"database-type": "mssql",
"connection-string": "xxx",
"options": {
"set-session-context": true
}
},
"runtime": {
"rest": {
"enabled": true,
"path": "/api",
"request-body-strict": true
},
"graphql": {
"enabled": true,
"path": "/graphql",
"allow-introspection": true,
"multiple-mutations": {
"create": {
"enabled": true
}
}
},
"host": {
"cors": {
"origins": [
"http://localhost:5000"
],
"allow-credentials": false
},
"authentication": {
"provider": "StaticWebApps"
},
"mode": "development"
}
}
}- To update graphql path in the runtime section, the option name should be
--runtime.graphql.path. - To update
set-session-contextin data-source, the option name should be--data-source.options.set-session-context.
-
Add the New
dab configureoptions inConfigureOptions.cslocated atsrc\Cli\Commands\ConfigureOptions.cs. -
Update the method
TryConfigureSettingsinConfigGenerator.cslocated atsrc\Cli\ConfigGenerator.cs. -
Use the existing validation to make sure the user provided input is valid.
-
Make sure the method
TryConfigureSettings(...)returnsfalsein case of any failures and no changes should me made to the config in this case. -
If the required validations associated with the user input is correct, apply the change and return
true.
-
Add Unit tests for command parsing and validation in
ConfigureOptionsTests.cslocated atsrc\Cli.Tests\ConfigureOptionsTests.cs. -
Add Integration tests for end-to-end configuration scenarios in
EndToEndTests.cslocated atsrc\Cli.Tests\EndToEndTests.cs. -
Manual testing for user interactions and error handling.
The dab configure command provides a streamlined way to update config properties outside of entities section.