Skip to content
Snippets Groups Projects
Commit 9ca02126 authored by Marcel Nellesen's avatar Marcel Nellesen
Browse files

Fix: Inclue "coscine/local/api/additional/url" for Host (coscine/issues#723)

parent 1b9591d3
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,10 @@ This library contains the common elements of the Coscine api projects. ...@@ -7,6 +7,10 @@ This library contains the common elements of the Coscine api projects.
Build this project by running either the build.ps1 or the build<span></span>.sh script. Build this project by running either the build.ps1 or the build<span></span>.sh script.
The project will be build and tested. The project will be build and tested.
## Necessary keys
The key "coscine/local/api/additional/url" is necessary for describing the host url.
### Links ### Links
* [Commit convention](docs/ESLintConvention.md) * [Commit convention](docs/ESLintConvention.md)
......
...@@ -8,6 +8,7 @@ namespace Coscine.ApiCommons ...@@ -8,6 +8,7 @@ namespace Coscine.ApiCommons
{ {
public string AppName { get; set; } = AssemblyName(); public string AppName { get; set; } = AssemblyName();
public string AppType { get; set; } = "apis"; public string AppType { get; set; } = "apis";
public string ApiUrl { get; set; }
public Version Version { get; set; } = ToSemanticVersion((System.Reflection.Assembly.GetEntryAssembly() != null) ? System.Reflection.Assembly.GetEntryAssembly().GetName().Version : System.Reflection.Assembly.GetExecutingAssembly().GetName().Version); public Version Version { get; set; } = ToSemanticVersion((System.Reflection.Assembly.GetEntryAssembly() != null) ? System.Reflection.Assembly.GetEntryAssembly().GetName().Version : System.Reflection.Assembly.GetExecutingAssembly().GetName().Version);
public string DomainName { get; set; } = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName; public string DomainName { get; set; } = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName;
public string HostName { get; set; } = Dns.GetHostName(); public string HostName { get; set; } = Dns.GetHostName();
...@@ -38,7 +39,7 @@ namespace Coscine.ApiCommons ...@@ -38,7 +39,7 @@ namespace Coscine.ApiCommons
{ $"{TraefikBackendPath}/url", $"http://{HostName}.{DomainName}:{Port}"}, { $"{TraefikBackendPath}/url", $"http://{HostName}.{DomainName}:{Port}"},
{ $"{TraefikBackendPath}/weight", $"{1}"}, { $"{TraefikBackendPath}/weight", $"{1}"},
{ $"{TraefikFrontendPath}/backend", AppName}, { $"{TraefikFrontendPath}/backend", AppName},
{ $"{TraefikFrontendPath}/routes/{AppName}/rule", $"Host:{HostName}.{DomainName};PathPrefix:/{PathPrefix}"} { $"{TraefikFrontendPath}/routes/{AppName}/rule", $"Host:{ApiUrl.Replace("https://", "")};PathPrefix:/{PathPrefix}"}
}; };
} }
} }
......
...@@ -53,6 +53,8 @@ namespace Coscine.ApiCommons ...@@ -53,6 +53,8 @@ namespace Coscine.ApiCommons
} }
} }
applicationInformation.ApiUrl = Configuration.GetString("coscine/local/api/additional/url");
// Traefik Configuration // Traefik Configuration
foreach (var kv in applicationInformation.TraefikValues.ToArray()) foreach (var kv in applicationInformation.TraefikValues.ToArray())
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment