File tree 4 files changed +7
-3
lines changed
4 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -19,12 +19,12 @@ namespace IoCConfig
19
19
{
20
20
public static class ConfigureServicesExtensions
21
21
{
22
- public static void AddCustomCors ( this IServiceCollection services )
22
+ public static void AddCustomCors ( this IServiceCollection services , IConfiguration configuration )
23
23
{
24
24
services . AddCors ( options =>
25
25
options . AddPolicy ( "CorsPolicy" ,
26
26
builder => builder
27
- . WithOrigins ( "http://localhost:5000" )
27
+ . WithOrigins ( configuration [ "Cors:Origins" ] )
28
28
. AllowAnyMethod ( )
29
29
. AllowAnyHeader ( )
30
30
. SetIsOriginAllowed ( ( host ) => true )
Original file line number Diff line number Diff line change 10
10
services . AddCustomOptions ( configuration ) ;
11
11
services . AddCustomServices ( ) ;
12
12
services . AddCustomAuthentication ( configuration ) ;
13
- services . AddCustomCors ( ) ;
13
+ services . AddCustomCors ( configuration ) ;
14
14
services . AddControllers ( ) ;
15
15
services . AddCustomSwagger ( ) ;
16
16
services . AddCustomMongoDbService ( configuration ) ;
Original file line number Diff line number Diff line change 19
19
]
20
20
},
21
21
"EnableSwagger" : true ,
22
+ "Cors" : {
23
+ "Origins" : " http://localhost:5000"
24
+ },
22
25
"Jwt" : {
23
26
"PrivateKey" : " " ,
24
27
"Issuer" : " https://localhost:8001" ,
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ services:
13
13
ASPNETCORE_URLS : " https://+;http://+"
14
14
ASPNETCORE_Kestrel__Certificates__Default__Path : " /https/aspnetcore.pfx"
15
15
ASPNETCORE_Kestrel__Certificates__Default__Password : " 1234567890"
16
+ Cors__Origins : " http://localhost:5000"
16
17
volumes :
17
18
- type : bind
18
19
source : ./aspnetcore.pfx
You can’t perform that action at this time.
0 commit comments