Add Aspire component

Aperta
#125 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
csharp
Ambito
tooling

Direzione di ricerca

Start with the AppHost.Program.cs and ServiceDefaults.Extensions.cs examples in the issue, then review the linked .NET Aspire overview and the existing client integration in this repository. Done means an Aspire component can provide the Flagsmith URL and EnvironmentKey, register FlagsmithClient through DI, and support the database reference and wait behavior described in the issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

It would be amazing, if we can have Flagsmith Aspire component.
I can provide some help in development of this aspire component.

Why?

  • There are such requests from the community dotnet/aspire#1570
  • It's the easiest way to start using Flagsmith with .NET
  • Improves Flagsmith adoption across community
  • Adds support for automatic DI registration

How it should look like

// AppHost.Program.cs

var builder = DistributedApplication.CreateBuilder(args);

var flagsmith = builder.AddFlagsmith();

var apiService = builder.AddProject<My_WebApi>("apiservice")
	.WithEnvironment(flagsmith); // Pupulates URL and EnvironmentKey
// ServiceDefaults.Extensions.cs

public static TBuilder AddServiceDefaults<TBuilder>(this TBuilder builder) where TBuilder : IHostApplicationBuilder
{
      builder.AddFlagsmithClient(); // Registers FlagsmithClient into DI with URL and EnvironmentKey
}

Example of configuration with database

// AppHost.Program.cs

var builder = DistributedApplication.CreateBuilder(args);

var postgresServer = builder.AddPostgres("postgresserver")
	// Mount the SQL scripts directory into the container.
	// Init script would create a flagsmith database, becuase Aspire doesn't create DB by default yet.
	.WithContainerName("postgresserver")
	.WithBindMount("../Postgres", "/docker-entrypoint-initdb.d");

var flagsmithDatabase = postgresServer.AddDatabase("flagsmithDatabase", databaseName: "flagsmithdb");

var flagsmith = builder.AddFlagsmith()
	.WithReference(flagsmithDatabase) // Populates DATABASE_URL
	.WaitFor(flagsmithDatabase)

var apiService = builder.AddProject<My_WebApi>("apiservice")
	.WithEnvironment(flagsmith);
Lingua principale
C#
Stelle
20
Fork
17
Merge medio
21h 47m
PR unite (30g)
8

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Flagsmith/flagsmith-dotnet-client

Tutte le issue di Flagsmith/flagsmith-dotnet-client

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.