microsoft / microsoft/aspire

YARP extension functions should support `ReferenceExpression`

Open
#10,770 1 comment 0 reactions 0 assignees View on GitHub
area-integrations yarp
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

It would be great if some of the YARP builder extensions supported `ReferenceExpressions`:

- `WithMatchHosts`
- `WithMatchPath`

That way we could pass in parameters there easily.

### Describe the solution you'd like

`WithMatchPath(ReferenceExpression)`

`WithMatchPath(in ReferenceExpression.ExpressionInterpolatedStringHandler)`

`WithMatchHosts(ReferenceExpression[])`

Not sure if we can support an array of `ReferenceExpression.ExpressionInterpolatedStringHandler` somehow.

### Additional context

In fact, there's several builder extensions that still lack `RerenceExpression` support:

### YARP Route Configuration

- **`WithMatchPath(string path)`** - Sets path pattern for route matching
- **`WithMatchMethods(params string[] methods)`** - Sets HTTP methods for route matching
- **`WithMatchHosts(params string[] hosts)`** - Sets host headers for route matching

### Volume and File System Operations
- **`WithDataBindMount(string source, bool isReadOnly = false)`** - Binds host directory to container data folder
- **`WithInitBindMount(string source, bool isReadOnly = true)`** - Binds host directory for initialization files (MongoDB)
- **`WithInitFiles(string source)`** - Copies init files into container
- **`WithDataVolume(string? name = null, bool isReadOnly = false)`** - Creates named volume for data

### Container Configuration
- **`WithPassword(IResourceBuilder password)`** - Sets container passwords
- **`WithHostPort(int? port)`** - Configures host port mappings

### Metadata and Configuration
- **`WithMetadata(IReadOnlyDictionary? metadata)`** - Sets route metadata
- **`WithTransforms(IReadOnlyList>? transforms)`** - Sets YARP transforms

### File Store Operations
- **`GetFileNameWithContent(string filenameTemplate, string sourceFilename)`** - Gets deterministic file paths based on content

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.