Skip to content

Commit

Permalink
- Added code to allow developers to add their own nominal settings on…
Browse files Browse the repository at this point in the history
… an `appsettings.<user_name>.json` file. These files are not committed to source control.
  • Loading branch information
rliberoff committed Jun 25, 2024
1 parent 3d6dc34 commit 4391b54
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/AIHub/Program.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
using Azure;
using Azure.AI.ContentSafety;

var builder = WebApplication.CreateBuilder(args);

builder.Configuration.SetBasePath(Directory.GetCurrentDirectory());

/* Load Configuration */
if (Debugger.IsAttached)
{
builder.Configuration.AddJsonFile(@"appsettings.debug.json", optional: true, reloadOnChange: true);
}

builder.Configuration.AddJsonFile($@"appsettings.{builder.Environment.EnvironmentName}.json", optional: true, reloadOnChange: true)
.AddJsonFile($@"appsettings.{Environment.UserName}.json", optional: true, reloadOnChange: true)
.AddEnvironmentVariables();

// Add services to the container.
builder.Services.AddControllersWithViews();

Expand All @@ -29,4 +38,4 @@
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");

app.Run();
await app.RunAsync();

0 comments on commit 4391b54

Please sign in to comment.