Skip to content

Commit

Permalink
Add serverBindingUrl to appSettings.json; rename “url” > “frontEndUrl”
Browse files Browse the repository at this point in the history
  • Loading branch information
bradymholt committed May 25, 2017
1 parent c66941d commit a353c91
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
7 changes: 6 additions & 1 deletion api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ public class Program
{
public static void Main(string[] args)
{
var config = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json")
.Build();

var host = new WebHostBuilder()
.UseKestrel()
.UseUrls($"http://0.0.0.0:5000")
.UseUrls(config["serverBindingUrl"])
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.Build();
Expand Down
2 changes: 1 addition & 1 deletion api/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
AutomaticChallenge = true,
RequireHttpsMetadata = false,
Audience = "resource-server",
Authority = Configuration["url"]
Authority = Configuration["frontEndUrl"]
});

app.UseOpenIddict();
Expand Down
5 changes: 4 additions & 1 deletion api/api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<None Update="wwwroot\**\*;Views;Areas\**\Views">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</None>
<None Update="appsettings.json">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="MailKit" Version="1.14.2" />
Expand Down Expand Up @@ -39,4 +42,4 @@
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
<DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.0.0" />
</ItemGroup>
</Project>
</Project>
3 changes: 2 additions & 1 deletion api/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"connectionStrings": {
"defaultConnection": "Host=localhost;Port=5433;Username=postgres;Password=postgres;Database=dotnetcore"
},
"url": "http://localhost:5000",
"frontEndUrl": "http://localhost:5000",
"serverBindingUrl": "http://0.0.0.0:5000",
"logging": {
"includeScopes": false,
"logLevel": {
Expand Down
4 changes: 2 additions & 2 deletions ops/roles/deploy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@

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

0 comments on commit a353c91

Please sign in to comment.