Skip to content

Commit 4bae396

Browse files
committed
🔧 Fixed how Serilog loads appsettings files.
1 parent 07ffc17 commit 4bae396

File tree

3 files changed

+50
-48
lines changed

3 files changed

+50
-48
lines changed

src/WorldDomination.SimpleHosting.SampleWebApplication.Tests/WorldDomination.SimpleHosting.SampleWebApplication.Tests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<PrivateAssets>all</PrivateAssets>
2222
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2323
</PackageReference>
24-
<PackageReference Include="coverlet.collector" Version="1.3.0">
24+
<PackageReference Include="coverlet.collector" Version="3.0.0">
2525
<PrivateAssets>all</PrivateAssets>
2626
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2727
</PackageReference>

src/WorldDomination.SimpleHosting/Program.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ private static IConfiguration GetConfigurationBuilder()
154154

155155
// Check any 'Environment' json files, like appsettings.Development.json.
156156
// REF: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/generic-host?#environmentname
157-
var environment = Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT") ?? "Production";
157+
var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ??
158+
Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT") ??
159+
"Production";
158160

159161
return builder
160162
.AddJsonFile($"appsettings.{environment}.json", optional: true)
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
2-
3-
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
5-
<LangVersion>latest</LangVersion>
6-
<PackageId>WorldDomination.SimpleHosting</PackageId>
7-
<Authors>Pure Krome</Authors>
8-
<Company>World Domination Technologies</Company>
9-
<Product>Simple : Hosting</Product>
10-
<Description>Making it simple to customize Hosting for your .NET Core 5.x+ application</Description>
11-
<Copyright>2020</Copyright>
12-
<OutputType>Library</OutputType>
13-
<PackageProjectUrl>https://github.com/PureKrome/SimpleHosting</PackageProjectUrl>
14-
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
15-
<RepositoryUrl>https://github.com/PureKrome/SimpleHosting</RepositoryUrl>
16-
<RepositoryType>.net c# .net-core</RepositoryType>
17-
<PackageTags>.net dotnet c# netcore aspnetcore aspnet-core hosting world-domination unicorn magicalunicorn magical-unicorn</PackageTags>
18-
19-
<!-- Microsoft.NET.Sdk.Web aren't ment for packaging into dll's. You usually publish a website.
20-
As such, we need to specify that this is ok to do -->
21-
<IsPackable>true</IsPackable>
22-
23-
<!-- Source Link. REF: https://github.com/dotnet/sourcelink -->
24-
<PublishRepositoryUrl>true</PublishRepositoryUrl>
25-
<EmbedUntrackedSources>true</EmbedUntrackedSources>
26-
<IncludeSymbols>true</IncludeSymbols>
27-
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
28-
<PackageIcon>icon.jpg</PackageIcon>
29-
<PackageIconUrl />
30-
31-
</PropertyGroup>
32-
33-
<ItemGroup>
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net5.0</TargetFramework>
5+
<LangVersion>latest</LangVersion>
6+
<PackageId>WorldDomination.SimpleHosting</PackageId>
7+
<Authors>Pure Krome</Authors>
8+
<Company>World Domination Technologies</Company>
9+
<Product>Simple : Hosting</Product>
10+
<Description>Making it simple to customize Hosting for your .NET Core 5.x+ application</Description>
11+
<Copyright>2020</Copyright>
12+
<OutputType>Library</OutputType>
13+
<PackageProjectUrl>https://github.com/PureKrome/SimpleHosting</PackageProjectUrl>
14+
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
15+
<RepositoryUrl>https://github.com/PureKrome/SimpleHosting</RepositoryUrl>
16+
<RepositoryType>.net c# .net-core</RepositoryType>
17+
<PackageTags>.net dotnet c# netcore aspnetcore aspnet-core hosting world-domination unicorn magicalunicorn magical-unicorn</PackageTags>
18+
19+
<!-- Microsoft.NET.Sdk.Web aren't ment for packaging into dll's. You usually publish a website.
20+
As such, we need to specify that this is ok to do -->
21+
<IsPackable>true</IsPackable>
22+
23+
<!-- Source Link. REF: https://github.com/dotnet/sourcelink -->
24+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
25+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
26+
<IncludeSymbols>true</IncludeSymbols>
27+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
28+
<PackageIcon>icon.jpg</PackageIcon>
29+
<PackageIconUrl />
30+
31+
</PropertyGroup>
32+
33+
<ItemGroup>
3434
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
3535
<PrivateAssets>all</PrivateAssets>
3636
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
37-
</PackageReference>
38-
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
39-
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
40-
</ItemGroup>
41-
42-
<ItemGroup>
43-
<None Include="..\..\LICENSE.txt">
44-
<Pack>True</Pack>
45-
<PackagePath></PackagePath>
37+
</PackageReference>
38+
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
39+
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
40+
</ItemGroup>
41+
42+
<ItemGroup>
43+
<None Include="..\..\LICENSE.txt">
44+
<Pack>True</Pack>
45+
<PackagePath></PackagePath>
4646
</None>
4747
<None Include="..\..\icon.jpg">
4848
<Pack>True</Pack>
4949
<PackagePath></PackagePath>
50-
</None>
51-
</ItemGroup>
52-
53-
</Project>
50+
</None>
51+
</ItemGroup>
52+
53+
</Project>

0 commit comments

Comments
 (0)