Skip to content

Add DbGate support for MySql #695

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Alirexaa
Copy link
Member

**Contributes #415 **

This pull request introduces support for integrating DbGate with MySQL resources. It includes updates to the core functionality, examples, documentation, and tests to enable and validate this feature. The most important changes are grouped below:

Core Functionality Enhancements:

  • Added a new WithDbGate extension method in MySqlBuilderExtensions to integrate DbGate with MySQL resources. This method configures environment variables and supports multiple MySQL instances.
  • Updated DbGateContainerImageTags to use <remarks> instead of <summary> for better documentation consistency.

Example Updates:

  • Modified examples/dbgate/CommunityToolkit.Aspire.Hosting.DbGate.AppHost/Program.cs to demonstrate the use of WithDbGate with multiple MySQL instances.
  • Updated examples/mysql-ext/CommunityToolkit.Aspire.Hosting.MySql.Extensions.AppHost/Program.cs to include a DbGate configuration example alongside Adminer.

Documentation Improvements:

  • Enhanced the README for CommunityToolkit.Aspire.Hosting.MySql.Extensions to include DbGate as a supported tool for MySQL interaction, with updated usage examples. [1] [2]

Testing Additions:

  • Added multiple unit tests in AddDbGateTests and ResourceCreationTests to validate the integration of DbGate with MySQL resources, including environment variable configurations, container image tags, and support for multiple instances. [1] [2] [3]

Dependency Updates:

  • Added a project reference to CommunityToolkit.Aspire.Hosting.DbGate in CommunityToolkit.Aspire.Hosting.MySql.Extensions.csproj to enable the new functionality.

PR Checklist

  • Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
  • Based off latest main branch of toolkit
  • New integration
    • Docs are written
    • Added description of major feature to project description for NuGet package (4000 total character limit, so don't push entire description over that)
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Contains NO breaking changes
  • Every new API (including internal ones) has full XML docs
  • Code follows all style conventions

Other information

@Alirexaa Alirexaa requested a review from Copilot May 20, 2025 18:45
@Alirexaa Alirexaa added this to the 9.5 milestone May 20, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for integrating DbGate with MySQL resources by introducing a new WithDbGate extension method, updating documentation and examples, and extending test coverage to validate the new functionality.

  • Added the WithDbGate extension method in MySqlBuilderExtensions to configure DbGate container resources.
  • Updated tests, documentation, and project references to support the new DbGate integration with MySQL.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/CommunityToolkit.Aspire.Hosting.MySql.Extensions.Tests/ResourceCreationTests.cs Added multiple tests to validate annotations and configuration for DbGate integration.
tests/CommunityToolkit.Aspire.Hosting.DbGate.Tests/AddDbGateTests.cs Updated tests to include MySQL resource annotations and resource naming changes.
src/CommunityToolkit.Aspire.Hosting.MySql.Extensions/README.md Updated README to reflect support for DbGate alongside Adminer.
src/CommunityToolkit.Aspire.Hosting.MySql.Extensions/MySqlBuilderExtensions.cs Introduced the WithDbGate extension method and configuration logic for MySQL resources.
src/CommunityToolkit.Aspire.Hosting.DbGate/DbGateContainerImageTags.cs Adjusted XML documentation from summary to remarks for consistency.
examples/mysql-ext/CommunityToolkit.Aspire.Hosting.MySql.Extensions.AppHost/Program.cs Updated sample to demonstrate DbGate usage with custom host port.
examples/dbgate/CommunityToolkit.Aspire.Hosting.DbGate.AppHost/Program.cs Added example usage of DbGate with multiple MySQL resources.
examples/dbgate/CommunityToolkit.Aspire.Hosting.DbGate.AppHost/CommunityToolkit.Aspire.Hosting.DbGate.AppHost.csproj Included project reference for MySQL Extensions to support DbGate integration.
Comments suppressed due to low confidence (2)

src/CommunityToolkit.Aspire.Hosting.MySql.Extensions/MySqlBuilderExtensions.cs:101

  • The early exit based on the existence of 'LABEL_mysql1' may skip configuration for additional MySQL instances when multiple WithDbGate calls occur; consider revising the logic to aggregate annotations from all resources or add detailed documentation explaining this behavior.
if (context.EnvironmentVariables.ContainsKey("LABEL_mysql" + counter))

src/CommunityToolkit.Aspire.Hosting.MySql.Extensions/MySqlBuilderExtensions.cs:126

  • [nitpick] Consider renaming the local variable 'CONNECTIONS' to follow camelCase (e.g., 'existingConnections') since it is not a constant.
string CONNECTIONS = context.EnvironmentVariables.GetValueOrDefault("CONNECTIONS")?.ToString() ?? string.Empty;

@Alirexaa Alirexaa linked an issue May 20, 2025 that may be closed by this pull request
@Alirexaa Alirexaa requested a review from aaronpowell May 20, 2025 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Integration with DbGate and WhoDB applications
1 participant