-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathProgram.cs
More file actions
41 lines (32 loc) · 1010 Bytes
/
Program.cs
File metadata and controls
41 lines (32 loc) · 1010 Bytes
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
33
34
35
36
37
38
39
40
41
// Imports
using Optimizely.Opal.Tools;
using OpalDemoTool.Tools.Greetings;
//#region Builder
var builder = WebApplication.CreateBuilder(args);
// Add the Opal Tools service
builder.Services.AddOpalToolService();
// Register each Tool class within the container
builder.Services.AddOpalTool<GreetingsTool>();
//#endregion
//#region App
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
//app.UseHsts();
// Enable HTTPS - Disabled because Render.com does this at infra level
//app.UseHttpsRedirection();
} else
{
app.UseDeveloperExceptionPage();
}
// Enable Opal Tool SDK
app.MapOpalTools();
// Redirect homepage to Discovery endpoint
app.MapGet("/", (HttpContext context) =>
{
context.Response.Redirect("/discovery", false);
});
app.Run();
//#endregion