microsoft / microsoft/aspire

`aspire get-cs [resource name]`

Open
#9,156 4 comments 1 reaction 0 assignees View on GitHub
area-app-model area-cli
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

We are considering introducing a feature to the CLI where from the command-prompt you can interrogate a running app host to get values to support running other commands on the command-line.

We might have something like this:

```bash
aspire get-cs mydb
stdout:
```

The way this would work is that when the apphost is launched we would determine the unix path that the apphost is listening on for a connection deterministically based on the apphost path.

The `aspire get-cs` command would find the apphost the same way that `aspire run` does (based on working directory context and `.aspire/settings.json`.

Once the apphost and live unix socket path is detected the apphost could be connected to and interrogated. We'd probably have to have mechanisms in the design to wait until the apphost was healthy.

We may wish to introduce an annotation with a callback into the app model which represents a value that can be queried for each resource. So you might end up with something like:

```csharp
builder.AddResource(...)
.WithGetCallback("connectionString", (...) => {});
```

That way developers designing resources could specifically expose additional values if they chose to (e.g. output values from azure provisioner deployments).

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.