Skip to content

Commit

Permalink
Merge pull request #11 from jagilber/issue10
Browse files Browse the repository at this point in the history
fix #issue10 add env variable for reverseproxy base uri into servicemanifest.xml
  • Loading branch information
Mikkel Mork Hegnhoj authored Jun 14, 2018
2 parents 9767935 + 90e46e9 commit cf664e8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion VotingWeb/Controllers/VotesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ public class VotesController : Controller
{
private readonly HttpClient httpClient;
private readonly FabricClient fabricClient;
private readonly string reverseProxyBaseUri;
private readonly StatelessServiceContext serviceContext;

public VotesController(HttpClient httpClient, StatelessServiceContext context, FabricClient fabricClient)
{
this.fabricClient = fabricClient;
this.httpClient = httpClient;
this.serviceContext = context;
this.reverseProxyBaseUri = Environment.GetEnvironmentVariable("ReverseProxyBaseUri");
}

// GET: api/Votes
Expand Down Expand Up @@ -113,7 +115,7 @@ public async Task<IActionResult> Delete(string name)
/// <returns></returns>
private Uri GetProxyAddress(Uri serviceName)
{
return new Uri($"http://localhost:19081{serviceName.AbsolutePath}");
return new Uri($"{this.reverseProxyBaseUri}{serviceName.AbsolutePath}");
}

/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions VotingWeb/PackageRoot/ServiceManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
<WorkingFolder>CodePackage</WorkingFolder>
</ExeHost>
</EntryPoint>
<EnvironmentVariables>
<EnvironmentVariable Name="ReverseProxyBaseUri" Value="http://localhost:19081"/>
</EnvironmentVariables>
</CodePackage>

<!-- Config package is the contents of the Config directoy under PackageRoot that contains an
Expand Down

0 comments on commit cf664e8

Please sign in to comment.