Skip to content

Commit

Permalink
[WorkerService.Sample]: added ksqlDbUrl to appsettings.json
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasfabian committed Feb 19, 2024
1 parent 2150a17 commit 0aaa248
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
using ksqlDB.RestApi.Client.WorkerService;
using ksqlDB.RestApi.Client.WorkerService.ksqlDB;

// use command ksqlDB.RestApi.Client-DotNet\Samples\ksqlDB.RestApi.Client.Sample> docker compose up -d
var ksqlDbUrl = Configuration().GetValue<string>("ksqlDbUrl") ?? throw new Exception("ksqlDbUrl is missing in appsettings.json");

IHost host = Host.CreateDefaultBuilder(args)
.ConfigureServices(services =>
{
var ksqlDbUrl = @"http://ksqldb-server:8088"; // use command ksqlDB.RestApi.Client-DotNet\Samples\ksqlDB.RestApi.Client.Sample> docker compose up -d
services.AddDbContext<IMoviesKSqlDbContext, MoviesKSqlDbContext>(
options =>
{
Expand All @@ -22,3 +23,11 @@
.Build();

await host.RunAsync();

IConfiguration Configuration()
{
return new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json")
.Build();
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ksqlDbUrl": "http://ksqldb-server:8088",
"Logging": {
"LogLevel": {
"Default": "Information",
Expand Down

0 comments on commit 0aaa248

Please sign in to comment.