Skip to content

Commit a353c91

Browse files
committed
Add serverBindingUrl to appSettings.json; rename “url” > “frontEndUrl”
1 parent c66941d commit a353c91

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

api/Program.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@ public class Program
1010
{
1111
public static void Main(string[] args)
1212
{
13+
var config = new ConfigurationBuilder()
14+
.SetBasePath(Directory.GetCurrentDirectory())
15+
.AddJsonFile("appsettings.json")
16+
.Build();
17+
1318
var host = new WebHostBuilder()
1419
.UseKestrel()
15-
.UseUrls($"http://0.0.0.0:5000")
20+
.UseUrls(config["serverBindingUrl"])
1621
.UseContentRoot(Directory.GetCurrentDirectory())
1722
.UseStartup<Startup>()
1823
.Build();

api/Startup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
164164
AutomaticChallenge = true,
165165
RequireHttpsMetadata = false,
166166
Audience = "resource-server",
167-
Authority = Configuration["url"]
167+
Authority = Configuration["frontEndUrl"]
168168
});
169169

170170
app.UseOpenIddict();

api/api.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
<None Update="wwwroot\**\*;Views;Areas\**\Views">
1111
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
1212
</None>
13+
<None Update="appsettings.json">
14+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
15+
</None>
1316
</ItemGroup>
1417
<ItemGroup>
1518
<PackageReference Include="MailKit" Version="1.14.2" />
@@ -39,4 +42,4 @@
3942
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
4043
<DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.0.0" />
4144
</ItemGroup>
42-
</Project>
45+
</Project>

api/appsettings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"connectionStrings": {
33
"defaultConnection": "Host=localhost;Port=5433;Username=postgres;Password=postgres;Database=dotnetcore"
44
},
5-
"url": "http://localhost:5000",
5+
"frontEndUrl": "http://localhost:5000",
6+
"serverBindingUrl": "http://0.0.0.0:5000",
67
"logging": {
78
"includeScopes": false,
89
"logLevel": {

ops/roles/deploy/tasks/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828

2929
- name: Configure app url
3030
lineinfile: dest="{{ deploy_directory }}/{{ appsetting_file }}"
31-
regexp="url\":"
32-
line="\"url\"{{':'}} \"http://{{webserver_name}}/\","
31+
regexp="frontEndUrl\":"
32+
line="\"frontEndUrl\"{{':'}} \"http://{{webserver_name}}/\","
3333
state="present"

0 commit comments

Comments
 (0)