Skip to content

Commit

Permalink
Merge pull request #9 from LykkeBusinessPlatform/LT-5906
Browse files Browse the repository at this point in the history
feat(LT-5906) - Use HttpConfigurationProvider when the SettingsUrl environment variable is an HTTP link
  • Loading branch information
samodovdi authored Nov 14, 2024
2 parents 91244bc + 4cb1fea commit 763bd04
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [[tbd]] ([[date]])

### Added
* Use `HttpConfigurationProvider` when the `SettingsUrl` environment variable is an HTTP link

## 9.0.1 (2024-07-25)

### Updated
Expand Down
6 changes: 6 additions & 0 deletions Lykke.Sdk.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ VisualStudioVersion = 15.0.27428.2037
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lykke.Sdk", "src\Lykke.Sdk\Lykke.Sdk.csproj", "{A121D66B-D07B-40E5-AA55-EA382D68D8D5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{B0308D06-B883-4444-A40C-D3B06725FD89}"
ProjectSection(SolutionItems) = preProject
CHANGELOG.md = CHANGELOG.md
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
2 changes: 1 addition & 1 deletion src/Lykke.Sdk/Lykke.Sdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<PackageReference Include="LykkeBiz.Common.ApiLibrary" Version="5.0.0" />
<PackageReference Include="Lykke.SlackNotification.AzureQueue" Version="2.0.5" />
<PackageReference Include="LykkeBiz.Logs" Version="8.4.0" />
<PackageReference Include="LykkeBiz.SettingsReader" Version="6.0.4" />
<PackageReference Include="LykkeBiz.SettingsReader" Version="9.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.7" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.1" />
Expand Down
13 changes: 13 additions & 0 deletions src/Lykke.Sdk/LykkeStarter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
using Autofac.Extensions.DependencyInjection;
using JetBrains.Annotations;
using Lykke.Common;
using Lykke.SettingsReader.ConfigurationProvider;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Serilog;

Expand Down Expand Up @@ -61,6 +63,16 @@ public static async Task Start<TStartup>(

try
{
var configurationBuilder = new ConfigurationBuilder()
.AddEnvironmentVariables();

if (Environment.GetEnvironmentVariable("SettingsUrl")?.StartsWith("http") ?? false)
{
configurationBuilder.AddHttpSourceConfiguration();
}

var configuration = configurationBuilder.Build();

var host = Host.CreateDefaultBuilder()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
Expand All @@ -72,6 +84,7 @@ public static async Task Start<TStartup>(
// Set properties and call methods on options
})
.UseUrls($"http://*:{port}")
.UseConfiguration(configuration)
.UseStartup<TStartup>();
})
.Build();
Expand Down

0 comments on commit 763bd04

Please sign in to comment.