From 717e15a9e0d35148a3cb0015b4b11b3abd291390 Mon Sep 17 00:00:00 2001 From: Ognjen Cirkovic Date: Sat, 16 Apr 2022 18:36:22 +0200 Subject: Updajtovan Cors. Sve se uzima iz konfiguracionog fajla --- backend/api/api/Program.cs | 5 +-- backend/api/api/Properties/launchSettings.json | 46 +++++++++++--------------- backend/api/api/appsettings.json | 41 ++++++++++++----------- 3 files changed, 43 insertions(+), 49 deletions(-) (limited to 'backend/api') diff --git a/backend/api/api/Program.cs b/backend/api/api/Program.cs index 576093fe..71509b38 100644 --- a/backend/api/api/Program.cs +++ b/backend/api/api/Program.cs @@ -64,11 +64,12 @@ builder.Services.Configure(x => builder.Services.AddSignalR(); builder.Services.AddControllers(); - +string frontApi = builder.Configuration.GetValue("AppSettings:FrontApi"); +string mlApi = builder.Configuration.GetValue("AppSettings:MlApi"); builder.Services.AddCors(options => { options.AddPolicy("CorsPolicy", builder => builder - .WithOrigins("http://localhost:4200") + .WithOrigins(frontApi, mlApi) .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials()); diff --git a/backend/api/api/Properties/launchSettings.json b/backend/api/api/Properties/launchSettings.json index 5c9dd2a8..f6c3fe8b 100644 --- a/backend/api/api/Properties/launchSettings.json +++ b/backend/api/api/Properties/launchSettings.json @@ -1,31 +1,23 @@ { - "$schema": "https://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:61918", - "sslPort": 0 - } - }, - "profiles": { - "api": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": false, - "launchUrl": "", - "applicationUrl": "http://localhost:5283", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:61918", + "sslPort": 0 + } }, - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": false, - "launchUrl": "", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } + "profiles": { + "api": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "launchUrl": "", + "applicationUrl": "http://localhost:5283", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } } - } } diff --git a/backend/api/api/appsettings.json b/backend/api/api/appsettings.json index 42f62b75..e96549a8 100644 --- a/backend/api/api/appsettings.json +++ b/backend/api/api/appsettings.json @@ -1,27 +1,28 @@ { "AppSettings": { "JwtToken": "2mnttqPtRb4GIWHFtagm", - "MlApi": "http://127.0.0.1:5543" + "MlApi": "http://127.0.0.1:5543", + "FrontApi": "http://localhost:4200" }, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "AllowedHosts": "*", - "UserStoreDatabaseSettings": { - /* LocalHost*/ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + "UserStoreDatabaseSettings": { + /* LocalHost*/ - "ConnectionString": "mongodb://127.0.0.1:27017/", - "DatabaseName": "si_project", - "CollectionName": "users", - "DatasetCollectionName": "Dataset", - "ModelCollectionName": "Model", - "PredictorCollectionName": "Predictor", - "FilesCollectionName": "Files", - "ExperimentCollectionName": "Experiment" - /* + "ConnectionString": "mongodb://127.0.0.1:27017/", + "DatabaseName": "si_project", + "CollectionName": "users", + "DatasetCollectionName": "Dataset", + "ModelCollectionName": "Model", + "PredictorCollectionName": "Predictor", + "FilesCollectionName": "Files", + "ExperimentCollectionName": "Experiment" + /* "ConnectionString": "mongodb+srv://si_user:si_user@sidatabase.twtfm.mongodb.net/myFirstDatabase?retryWrites=true&w=majority", "DatabaseName": "si_db", "CollectionName": "users", @@ -30,5 +31,5 @@ "PredictorCollectionName": "Predictor", "FilesCollectionName": "Files", "ExperimentCollectionName": "Experiment" */ - } + } } \ No newline at end of file -- cgit v1.2.3