Skip to content

Commit

Permalink
🔧 Fixed how Serilog loads appsettings files.
Browse files Browse the repository at this point in the history
  • Loading branch information
PureKrome committed Jan 10, 2021
1 parent 07ffc17 commit 4bae396
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PackageReference Include="coverlet.collector" Version="3.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
4 changes: 3 additions & 1 deletion src/WorldDomination.SimpleHosting/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ private static IConfiguration GetConfigurationBuilder()

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

return builder
.AddJsonFile($"appsettings.{environment}.json", optional: true)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>latest</LangVersion>
<PackageId>WorldDomination.SimpleHosting</PackageId>
<Authors>Pure Krome</Authors>
<Company>World Domination Technologies</Company>
<Product>Simple : Hosting</Product>
<Description>Making it simple to customize Hosting for your .NET Core 5.x+ application</Description>
<Copyright>2020</Copyright>
<OutputType>Library</OutputType>
<PackageProjectUrl>https://github.com/PureKrome/SimpleHosting</PackageProjectUrl>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<RepositoryUrl>https://github.com/PureKrome/SimpleHosting</RepositoryUrl>
<RepositoryType>.net c# .net-core</RepositoryType>
<PackageTags>.net dotnet c# netcore aspnetcore aspnet-core hosting world-domination unicorn magicalunicorn magical-unicorn</PackageTags>

<!-- Microsoft.NET.Sdk.Web aren't ment for packaging into dll's. You usually publish a website.
As such, we need to specify that this is ok to do -->
<IsPackable>true</IsPackable>

<!-- Source Link. REF: https://github.com/dotnet/sourcelink -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageIcon>icon.jpg</PackageIcon>
<PackageIconUrl />

</PropertyGroup>

<ItemGroup>
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>latest</LangVersion>
<PackageId>WorldDomination.SimpleHosting</PackageId>
<Authors>Pure Krome</Authors>
<Company>World Domination Technologies</Company>
<Product>Simple : Hosting</Product>
<Description>Making it simple to customize Hosting for your .NET Core 5.x+ application</Description>
<Copyright>2020</Copyright>
<OutputType>Library</OutputType>
<PackageProjectUrl>https://github.com/PureKrome/SimpleHosting</PackageProjectUrl>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<RepositoryUrl>https://github.com/PureKrome/SimpleHosting</RepositoryUrl>
<RepositoryType>.net c# .net-core</RepositoryType>
<PackageTags>.net dotnet c# netcore aspnetcore aspnet-core hosting world-domination unicorn magicalunicorn magical-unicorn</PackageTags>

<!-- Microsoft.NET.Sdk.Web aren't ment for packaging into dll's. You usually publish a website.
As such, we need to specify that this is ok to do -->
<IsPackable>true</IsPackable>

<!-- Source Link. REF: https://github.com/dotnet/sourcelink -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageIcon>icon.jpg</PackageIcon>
<PackageIconUrl />

</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\LICENSE.txt">
<Pack>True</Pack>
<PackagePath></PackagePath>
</PackageReference>
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\LICENSE.txt">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
<None Include="..\..\icon.jpg">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>

</Project>
</None>
</ItemGroup>

</Project>

0 comments on commit 4bae396

Please sign in to comment.