Skip to content

Remove code that uses the ConnectionStrings__<name> environment variable #312

@alistairmatthews

Description

@alistairmatthews

Although in the Dashboard there is often an environment variable such as ConnectionStrings__postgresdb listed, this shouldn't be used in code for two reasons:

  • The double-underscore returns null and should be replaced with a colon.
  • We should always encourage the Aspire method instead: var connectionUri = builder.Configuration.GetConnectionString("postgresdb");

Search for all instances of builder.Configuration.GetValue<string>("ConnectionStrings__<name>");
and replace them with: builder.Configuration.GetConnectionString("postgresdb");

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions