Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions src/GreetingsService/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,16 @@ public static void Main()
Indented = false
};
});
builder.WebHost.ConfigureKestrel(options =>
{
options.ListenAnyIP(5432);
});

var hasStarted = false;
var app = builder.Build();

// Listen to 5432
app.Urls.Add("http://*:5432");

// configure the Prometheus metrics endpoint, should appear at /metrics
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapMetrics();
});

app.MapMetrics();

// liveness probe, return HTTP status code 500 if you want the container to be restarted
app.MapGet("/live", () => Results.Ok());
// rediness probe, return 200 OK when the application is ready to respond to requests.
Expand All @@ -59,13 +54,15 @@ public static void Main()
return new Greeting(message);
});

app.Run();
app.Start();

// mark as true when complex startup logic has completed and the service is ready to take requests.
hasStarted = true;

app.WaitForShutdown();
}
}

public record Greeting(string Message);

public class GreetingApp { }
public class GreetingApp { }