Skip to content

[New article]: Polyglot environment variables #5308

@sebastienros

Description

@sebastienros

This PR introduces new environment variables for referenced services and/or endpoints. I am not sure this deserves a specific article but we might want to update existing samples, at least the polyglot ones, such that these are used instead of .NET Service Discovery ones like services__myapi_https__0.

Most notably:

var projectA = builder.AddProject<ProjectA>("projecta");
var projectB = builder.AddProject<ProjectB>("b").WithReference(projectA);

Will generate the ENVS "PROJECTA_HTTP" and "PROJECTA_HTTPS", i.e. a value for each endpoint, with {RESOURCENAME}_{ENDPOINTNAME}".

var projectA = builder.AddProject<ProjectA>("projecta");
var projectB = builder.AddProject<ProjectB>("b").WithReference(projectA, "custom");

Will generate the ENVS "PROJECTA_HTTP" and "PROJECTA_HTTPS", i.e. a value for each endpoint, with {RESOURCENAME}_{ENDPOINTNAME}".

To get a specific endpoint and a specific ENV:

var projectA = builder.AddProject<ProjectA>("projecta");
var projectB = builder.AddProject<ProjectB>("b").WithEnvironment("PROJECTA_URL", projectA.GetEndpoint("https"));

Will generate an ENV "PROJECTA_URL".

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

🔖 Ready

Relationships

None yet

Development

No branches or pull requests

Issue actions