-
Notifications
You must be signed in to change notification settings - Fork 301
Add CLI parameter for data-source.health.name #3059
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Exposes the existing data-source.health.name config property as a dab configure CLI option and ensures it round-trips correctly through config serialization.
Changes:
- Added
--data-source.health.nameoption toConfigureOptions. - Updated
TryUpdateConfiguredDataSourceOptionsto create/updateDataSource.Health.Name. - Updated datasource health JSON converter to serialize the
healthobject whenname(or threshold) is set, plus added unit tests for add/update scenarios.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Cli/Commands/ConfigureOptions.cs | Adds CLI option binding for data-source.health.name. |
| src/Cli/ConfigGenerator.cs | Applies the new option to runtime config by creating/updating datasource health config. |
| src/Config/Converters/DatasourceHealthOptionsConvertorFactory.cs | Ensures health is written when name is present (and when threshold was user-provided). |
| src/Cli.Tests/ConfigureOptionsTests.cs | Adds tests for adding/updating datasource health name while preserving existing health settings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Preserve threshold only if it was explicitly set by the user | ||
| int? thresholdToPreserve = datasourceHealthCheckConfig.UserProvidedThresholdMs ? datasourceHealthCheckConfig.ThresholdMs : null; | ||
| datasourceHealthCheckConfig = new DatasourceHealthCheckConfig( | ||
| enabled: datasourceHealthCheckConfig.Enabled, |
Copilot
AI
Jan 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When updating an existing DatasourceHealthCheckConfig, passing enabled: datasourceHealthCheckConfig.Enabled will always set UserProvidedEnabled = true (because the constructor treats non-null enabled as user-provided). If the existing config omitted health.enabled (defaulting to true), updating the name will now write enabled: true and permanently mark it as user-provided. To truly preserve existing settings, pass enabled: datasourceHealthCheckConfig.UserProvidedEnabled ? datasourceHealthCheckConfig.Enabled : null (or otherwise carry forward the original UserProvidedEnabled state).
| enabled: datasourceHealthCheckConfig.Enabled, | |
| enabled: datasourceHealthCheckConfig.UserProvidedEnabled ? datasourceHealthCheckConfig.Enabled : null, |
Why make this change?
The
data-source.health.nameproperty exists in the DAB schema but was not exposed as a CLI parameter, making it impossible to configure via command line.What is this change?
Added
--data-source.health.nameCLI parameter to thedab configurecommand.Implementation details:
DataSourceHealthNameparameter toConfigureOptionswith CLI option bindingTryUpdateConfiguredDataSourceOptionsto create or update health configuration while preserving existing settingsDatasourceHealthOptionsConvertorFactory.Write()to serialize health object when name is set (previously only serialized when enabled was explicitly provided)How was this tested?
TestAddDataSourceHealthName- validates adding name to config without health sectionTestUpdateDataSourceHealthName- validates updating name while preserving existing health settingsSample Request(s)
CLI usage:
Result:
{ "data-source": { "database-type": "mssql", "connection-string": "@env('MSSQL_CONNECTION_STRING')", "health": { "enabled": true, "name": "Production SQL Server" } } }Original prompt
dab configure --data-source.health.nameis missing. #3058💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.