1
- var appName = "Ordering.API " ;
1
+ var appName = "Web.Shopping.HttpAggregator " ;
2
2
var builder = WebApplication . CreateBuilder ( args ) ;
3
- builder . WebHost . ConfigureAppConfiguration ( cb =>
4
- {
5
- var sources = cb . Sources ;
6
- sources . Insert ( 3 , new Microsoft . Extensions . Configuration . Json . JsonConfigurationSource ( )
7
- {
8
- Optional = true ,
9
- Path = "appsettings.localhost.json" ,
10
- ReloadOnChange = false
11
- } ) ;
12
- } ) ;
3
+
13
4
builder . Host . UseSerilog ( CreateSerilogLogger ( builder . Configuration ) ) ;
14
5
builder . Services . AddHealthChecks ( )
15
6
. AddCheck ( "self" , ( ) => HealthCheckResult . Healthy ( ) )
20
11
. AddUrlGroup ( new Uri ( builder . Configuration [ "PaymentUrlHC" ] ) , name : "paymentapi-check" , tags : new string [ ] { "paymentapi" } ) ;
21
12
builder . Services . AddCustomMvc ( builder . Configuration )
22
13
. AddCustomAuthentication ( builder . Configuration )
23
- //.AddCustomAuthorization(Configuration)
24
14
. AddApplicationServices ( )
25
15
. AddGrpcServices ( ) ;
26
16
var app = builder . Build ( ) ;
@@ -93,8 +83,6 @@ Serilog.ILogger CreateSerilogLogger(IConfiguration configuration)
93
83
. Enrich . WithProperty ( "ApplicationContext" , Program . AppName )
94
84
. Enrich . FromLogContext ( )
95
85
. WriteTo . Console ( )
96
- //.WriteTo.Seq(string.IsNullOrWhiteSpace(seqServerUrl) ? "http://seq" : seqServerUrl)
97
- //.WriteTo.Http(string.IsNullOrWhiteSpace(logstashUrl) ? "http://logstash:8080" : logstashUrl, null)
98
86
. ReadFrom . Configuration ( configuration )
99
87
. CreateLogger ( ) ;
100
88
}
@@ -136,15 +124,12 @@ public static IServiceCollection AddCustomMvc(this IServiceCollection services,
136
124
137
125
services . AddSwaggerGen ( options =>
138
126
{
139
- //options.DescribeAllEnumsAsStrings();
140
-
141
127
options . SwaggerDoc ( "v1" , new OpenApiInfo
142
128
{
143
129
Title = "Shopping Aggregator for Web Clients" ,
144
130
Version = "v1" ,
145
131
Description = "Shopping Aggregator for Web Clients"
146
132
} ) ;
147
-
148
133
options . AddSecurityDefinition ( "oauth2" , new OpenApiSecurityScheme
149
134
{
150
135
Type = SecuritySchemeType . OAuth2 ,
@@ -154,7 +139,6 @@ public static IServiceCollection AddCustomMvc(this IServiceCollection services,
154
139
{
155
140
AuthorizationUrl = new Uri ( $ "{ configuration . GetValue < string > ( "IdentityUrlExternal" ) } /connect/authorize") ,
156
141
TokenUrl = new Uri ( $ "{ configuration . GetValue < string > ( "IdentityUrlExternal" ) } /connect/token") ,
157
-
158
142
Scopes = new Dictionary < string , string > ( )
159
143
{
160
144
{ "webshoppingagg" , "Shopping Aggregator for Web Clients" }
@@ -165,7 +149,6 @@ public static IServiceCollection AddCustomMvc(this IServiceCollection services,
165
149
166
150
options . OperationFilter < AuthorizeCheckOperationFilter > ( ) ;
167
151
} ) ;
168
-
169
152
services . AddCors ( options =>
170
153
{
171
154
options . AddPolicy ( "CorsPolicy" ,
0 commit comments