diff --git a/PortBlog.API/Program.cs b/PortBlog.API/Program.cs index c3ad400..ac6567c 100644 --- a/PortBlog.API/Program.cs +++ b/PortBlog.API/Program.cs @@ -17,6 +17,15 @@ Log.Logger = new LoggerConfiguration() var builder = WebApplication.CreateBuilder(args); +var urls = builder.Configuration.GetRequiredSection("Urls"); + +if (!string.IsNullOrEmpty(urls.Value)) +{ + var allowedUrlsToUse = urls.Value.Split(','); + + builder.WebHost.UseUrls(allowedUrlsToUse); +} + builder.Host.UseSerilog(); // Add services to the container. diff --git a/PortBlog.API/appsettings.Development.json b/PortBlog.API/appsettings.Development.json index 6c5f3a2..5b58353 100644 --- a/PortBlog.API/appsettings.Development.json +++ b/PortBlog.API/appsettings.Development.json @@ -10,5 +10,6 @@ "Microsoft.AspNetCore": "Warning" } }, - "XApiKey": "c6eAXYcNT873TT7BfMgQyS4ii7hxa53TLEUN7pAGaaU=" + "XApiKey": "c6eAXYcNT873TT7BfMgQyS4ii7hxa53TLEUN7pAGaaU=", + "Urls": "http://localhost:5000" }