-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
32 lines (23 loc) · 1.01 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using Microsoft.EntityFrameworkCore;
using CustomerProfileAPI;
using CustomerProfileAPI.Models;
using Steeltoe.Connector.PostgreSql;
using Steeltoe.Connector.PostgreSql.EFCore;
using Steeltoe.Extensions.Configuration.Kubernetes.ServiceBinding;
using Steeltoe.Management.Endpoint;
var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddKubernetesServiceBindings();
builder.Services.AddDbContext<CustomerProfilesContext>((services, options) => options.UseNpgsql(builder.Configuration));
builder.Services.AddPostgresHealthContributor(builder.Configuration);
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
// Learn more about management endpoints at https://docs.steeltoe.io/api/v3/management/
builder.WebHost.AddAllActuators();
var app = builder.Build();
app.UseSwagger();
app.UseSwaggerUI();
app.UseHttpsRedirection();
app.MapControllers();
await PostgreSqlSeeder.CreateSampleDataAsync(app.Services);
app.Run();