Database ConnectionString all Empty inside K8s. #9380
-
AppHost Program.cs
using Projects;
var builder = DistributedApplication.CreateBuilder(args);
builder.AddKubernetesPublisher();
var pgSqlPassword = builder.AddParameter("Postgres-Password");
var postgres = builder.AddPostgres("postgres", password:pgSqlPassword)
.WithContainerName("Postgres")
.WithDataVolume()
.WithLifetime(ContainerLifetime.Persistent)
.WithPgAdmin(x =>
{
x.WithContainerName("PgAdmin");
x.WithLifetime(ContainerLifetime.Persistent);
});
var redis = builder.AddRedis("Redis")
.WithContainerName("Redis")
.WithLifetime(ContainerLifetime.Persistent);
var postgresDb = postgres.AddDatabase("postgres-db");
var hangFireDb = postgres.AddDatabase("hangfire-db");
var paymentService = builder.AddProject<OnlySwipe_PaymentService_Grpc>("Payment-Service-Grpc");
var onlySwipeApi = builder
.AddProject<OnlySwipe_API>("OnlySwipe-API")
.WithReference(postgresDb)
.WithReference(hangFireDb)
.WithReference(paymentService)
.WithReference(redis)
.WaitFor(postgresDb)
.WaitFor(hangFireDb)
.WaitFor(paymentService)
.WaitFor(redis)
.WithEnvironment("PaymentServiceEndpoint", paymentService.GetEndpoint("http"));
onlySwipeApi.WithUrlForEndpoint("http", url =>
{
url.DisplayText = "Swagger";
url.Url += "/Swagger";
});
onlySwipeApi.WithUrl($"{onlySwipeApi.GetEndpoint("http")}/Hangfire", "HangFire");
onlySwipeApi.WithUrl($"{onlySwipeApi.GetEndpoint("http")}/healthCheckUi", "HealthCheck");
builder.Build().Run(); API ApplicationServiceExtension.cs
var hangFireDbConnection = configuration.GetConnectionString(configuration["SqlSettings:HandFireDb"]!);
var paymentServiceConnection = configuration["PaymentServiceEndpoint"];
Console.WriteLine($"HangFire Connection : {hangFireDbConnection}");
Console.WriteLine($"PaymentService Connection : {paymentServiceConnection}"); appsettings.json
"SqlSettings": {
"MainDb": "postgres-db",
"HandFireDb": "hangfire-db"
},
"PaymentServiceEndpoint": "http://PaymentService"
why the connectionString all empty ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
To set expectations, these publishers are in "preview" so they are lots of bugs and its possible you ran into some. That said, I don't know what your issue is or how you deployed. If you can share more of what you did and what the output was then we can figure out where the problems are and file the appropriate issues. |
Beta Was this translation helpful? Give feedback.
-
using aspire cli if i generate the helm yaml file they have lot of type miss match issue, like some variable required int for port but aspire cli was passing string value and it is now wiring-up the database and other service automatically, so i use aspire8 to generate the helm yaml file and deploy everting this working fine, yea i know aspire cli is in preview anyway thank for the help and waiting for the stable release to see how it is perform tanks. aspirate generate --output-format helm |
Beta Was this translation helpful? Give feedback.
This is by design though we dont warn. We dont emit passwords in these files, so you need to fill them in.