Skip to content

EnvironmentVariables config add missing prefix POSTGRESQLCONNSTR_ - #57546

Closed
thohng wants to merge 3 commits into
dotnet:mainfrom
NetLah-external:env-variables-config-add-missing-postgresqlconnstr
Closed

thohng wants to merge 3 commits into
dotnet:mainfrom
NetLah-external:env-variables-config-add-missing-postgresqlconnstr

Conversation

@thohng

@thohng thohng commented Aug 17, 2021

Copy link
Copy Markdown

Add missing connection string prefix POSTGRESQLCONNSTR_ for EnvironmentVariablesConfigurationProvider

To fix #57545

@ghost ghost added area-Extensions-Configuration community-contribution Indicates that the PR has been added by a community member labels Aug 17, 2021
@ghost

ghost commented Aug 17, 2021

Copy link
Copy Markdown

Tagging subscribers to this area: @maryamariyan, @safern
See info in area-owners.md if you want to be subscribed.

Issue Details

Add missing connection string prefix POSTGRESQLCONNSTR_ for EnvironmentVariablesConfigurationProvider

To fix #57545

Author: thohng
Assignees: -
Labels:

area-Extensions-Configuration

Milestone: -

@davidfowl

Copy link
Copy Markdown
Member

Tests?

@thohng

thohng commented Aug 17, 2021

Copy link
Copy Markdown
Author

Let me update the tests

else if (key.StartsWith(PostgreSqlServerPrefix, StringComparison.OrdinalIgnoreCase))
{
prefix = PostgreSqlServerPrefix;
provider = "Npgsql";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@roji Does this look right to you?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sure, I guess (don't have much context here)... Though note that Npgsql isn't the only PG provider out there, so equating PostgreSQL with Npgsql could be problematic.

The same problem seems actually more acute: for SQL Server, Microsoft.Data.SqlClient is the modern thing to be used rather than System.Data.SqlClient. And for MySQL there's MySqlConnector, which is frequently better/faster.

Do we have to make a provider choice here, i.e. could we put "Postgres" instead of "Npgsql"? The application would then get the connection string for PG and pass it to Npgsql, assuming it's using that?

@dnfadmin

dnfadmin commented Aug 17, 2021 •

Copy link
Copy Markdown

CLA assistant check
All CLA requirements met.

@maryamariyan maryamariyan added this to the 7.0.0 milestone Aug 24, 2021
@maryamariyan
maryamariyan marked this pull request as draft October 25, 2021 17:57
@maryamariyan

Copy link
Copy Markdown
Contributor

To further summarize @roji 's comment above here:

The Azure UI is mentions databases (SQL Server, PostgreSQL), where the code in the environment variable configuration provider seems to translate that (SQL Server) to concrete providers (System.Data.SqlClient).

For the cases where there might be multiple possible providers for a given database (e.g. Microsoft.Data.SqlClient), it would be odd to have to hardcode them at this level in .NET runtime.

next TODO for this PR to progress:

  • trace down what provider string from line 71 does and what it affects exactly.
  • if we decide we want to integrate PostgreSQL in a way which is consistent with what we're doing with the other providers, then just putting in Npgsql as seen in the PR might be fine to do.

Switching to draft PR, since it's not active atm.

@ghost ghost closed this Nov 24, 2021
@ghost

ghost commented Nov 24, 2021

Copy link
Copy Markdown

Draft Pull Request was automatically closed for inactivity. Please let us know if you'd like to reopen it.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 25, 2021
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-Extensions-Configuration community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EnvironmentVariablesConfigurationProvider not load connection string prefix POSTGRESQLCONNSTR_ on Azure AppService

5 participants