-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove icon service dependency on core #77
base: main
Are you sure you want to change the base?
Changes from all commits
75b7e26
24deb9c
c8da2ba
788aac5
2ce6574
abd4a19
400a2f6
d9667ea
6732857
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,41 @@ | ||
using Bit.Core.Utilities; | ||
using System; | ||
using Microsoft.AspNetCore.Hosting; | ||
using Microsoft.Extensions.Hosting; | ||
using Serilog.Events; | ||
using Serilog; | ||
|
||
namespace Bit.Icons | ||
{ | ||
public class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
Host | ||
.CreateDefaultBuilder(args) | ||
.ConfigureWebHostDefaults(webBuilder => | ||
{ | ||
webBuilder.UseStartup<Startup>(); | ||
webBuilder.ConfigureLogging((hostingContext, logging) => | ||
logging.AddSerilog(hostingContext, e => e.Level >= LogEventLevel.Error)); | ||
}) | ||
.Build() | ||
.Run(); | ||
Log.Logger = new LoggerConfiguration() | ||
.WriteTo.Console() | ||
.CreateBootstrapLogger(); | ||
|
||
try | ||
{ | ||
Host | ||
.CreateDefaultBuilder(args) | ||
.UseSerilog((context, configuration) => | ||
{ | ||
configuration.ReadFrom.Configuration(context.Configuration); | ||
}) | ||
.ConfigureWebHostDefaults(webBuilder => | ||
{ | ||
webBuilder.UseStartup<Startup>(); | ||
}) | ||
.Build() | ||
.Run(); | ||
} | ||
catch (Exception ex) | ||
{ | ||
Log.Fatal(ex, "Host terminated unexpectedly"); | ||
} | ||
finally | ||
{ | ||
Log.CloseAndFlush(); | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
using System; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Consider adding XML comments for public methods and classes to maintain documentation standards. |
||
using System.Globalization; | ||
using Bit.Core.Settings; | ||
using Bit.Core.Utilities; | ||
using Bit.Icons.Services; | ||
using Bit.SharedWeb.Utilities; | ||
using Bit.SharedKernel.Utilities; | ||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.AspNetCore.Hosting; | ||
using Microsoft.AspNetCore.Http; | ||
|
@@ -30,10 +28,9 @@ public void ConfigureServices(IServiceCollection services) | |
services.AddOptions(); | ||
|
||
// Settings | ||
var globalSettings = services.AddGlobalSettingsServices(Configuration); | ||
var iconsSettings = new IconsSettings(); | ||
ConfigurationBinder.Bind(Configuration.GetSection("IconsSettings"), iconsSettings); | ||
services.AddSingleton(s => iconsSettings); | ||
services.AddSingleton(_ => iconsSettings); | ||
|
||
// Cache | ||
services.AddMemoryCache(options => | ||
|
@@ -52,11 +49,8 @@ public void ConfigureServices(IServiceCollection services) | |
public void Configure( | ||
IApplicationBuilder app, | ||
IWebHostEnvironment env, | ||
IHostApplicationLifetime appLifetime, | ||
GlobalSettings globalSettings) | ||
IHostApplicationLifetime appLifetime) | ||
{ | ||
app.UseSerilog(env, appLifetime, globalSettings); | ||
|
||
// Add general security headers | ||
app.UseMiddleware<SecurityHeadersMiddleware>(); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
{ | ||
"Logging": { | ||
"IncludeScopes": false, | ||
"LogLevel": { | ||
"Default": "Debug", | ||
"System": "Information", | ||
"Microsoft": "Information" | ||
} | ||
"Serilog": { | ||
"WriteTo": [ | ||
{ "Name": "Console" } | ||
] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,7 @@ | ||
{ | ||
"Logging": { | ||
"IncludeScopes": false, | ||
"LogLevel": { | ||
"Default": "Debug", | ||
"System": "Information", | ||
"Microsoft": "Information" | ||
}, | ||
"Console": { | ||
"IncludeScopes": true, | ||
"LogLevel": { | ||
"Default": "Warning", | ||
"System": "Warning", | ||
"Microsoft": "Warning", | ||
"Microsoft.Hosting.Lifetime": "Information" | ||
} | ||
"Serilog": { | ||
"MinimumLevel": { | ||
"Default": "Error" | ||
} | ||
} | ||
} | ||
Comment on lines
1
to
7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Ensure that this Serilog configuration is consistent with other services and provides sufficient logging information for production troubleshooting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: VersionHelper.GetVersion() is now used instead of CoreHelpers.GetVersion(). Verify that VersionHelper provides the same functionality and returns the version in the expected format.