Skip to content

Commit

Permalink
Merge pull request #17 from AzureCosmosDB/web-api-fixes
Browse files Browse the repository at this point in the history
Enable cors and update settings
  • Loading branch information
joelhulen authored Aug 24, 2023
2 parents fd8e5fe + 94f665c commit 63343a1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
17 changes: 15 additions & 2 deletions src/CoreClaims.WebAPI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class Program
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
var allowAllCorsOrigins = "AllowAllOrigins";

builder.Logging.ClearProviders();
builder.Logging.AddConsole();
Expand All @@ -35,6 +36,16 @@ public static void Main(string[] args)

builder.Services.Configure<BusinessRuleOptions>(builder.Configuration.GetSection(nameof(BusinessRuleOptions)));
builder.Services.Configure<RulesEngineSettings>(builder.Configuration.GetSection("RulesEngine"));
builder.Services.AddCors(policyBuilder =>
{
policyBuilder.AddPolicy(allowAllCorsOrigins,
policy =>
{
policy.AllowAnyOrigin();
policy.AllowAnyHeader();
policy.AllowAnyMethod();
});
});

builder.Services.AddSingleton(s =>
{
Expand Down Expand Up @@ -82,8 +93,6 @@ public static void Main(string[] args)

app.UseHttpsRedirection();

//app.UseAuthorization();

// Map the REST endpoints:
using (var scope = app.Services.CreateScope())
{
Expand All @@ -97,6 +106,10 @@ public static void Main(string[] args)
}
}

app.UseCors(allowAllCorsOrigins);

//app.UseAuthorization();

app.Run();
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/CoreClaims.WebAPI/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
"publishAllPorts": true,
"useSSL": true
"useSSL": true,
"httpPort": 41359,
"sslPort": 32770
}
},
"$schema": "https://json.schemastore.org/launchsettings.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,5 @@
"DemoMode": true,
"DemoAdjudicatorId": "df166300-5a78-3502-a46a-832842197811",
"DemoManagerAdjudicatorId": "a735bf55-83e9-331a-899d-a82a60b9f60c"
},
"RulesEngine": {
"OpenAIEndpoint": "{{openAiEndpoint}}",
"OpenAIKey": "{{openAiKey}}",
"OpenAICompletionsDeployment": "{{openAiDeployment}}"
}
}

0 comments on commit 63343a1

Please sign in to comment.