Skip to content

Commit 8bcc92a

Browse files
committed
Adjusted DB: test
1 parent 4d72b8d commit 8bcc92a

File tree

174 files changed

+11796
-166
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+11796
-166
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<Properties StartupConfiguration="{9963B397-0D8F-4C87-B0CE-2BDB75C5480B}|BookStoreApi">
2+
<MonoDevelop.Ide.DebuggingService.PinnedWatches />
3+
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
4+
<MonoDevelop.Ide.DebuggingService.Breakpoints>
5+
<BreakpointStore />
6+
</MonoDevelop.Ide.DebuggingService.Breakpoints>
7+
<MonoDevelop.Ide.ItemProperties.crowdlaunch-backend PreferredExecutionTarget="/Applications/Google Chrome.app" />
8+
<MultiItemStartupConfigurations />
9+
<MonoDevelop.Ide.Workbench ActiveDocument="Helpers/DatabaseConfig.cs">
10+
<Files>
11+
<File FileName="Startup.cs" />
12+
<File FileName=".env" Line="1" Column="13" />
13+
<File FileName="Program.cs" Line="20" Column="1" />
14+
<File FileName="appsettings.json" />
15+
<File FileName="Helpers/DatabaseConfig.cs" Line="17" Column="1" />
16+
</Files>
17+
<Pads>
18+
<Pad Id="ProjectPad">
19+
<State name="__root__">
20+
<Node name="crowdlaunch-backend" expanded="True">
21+
<Node name="crowdlaunch-backend" expanded="True" selected="True">
22+
<Node name="Dependencies" expanded="True">
23+
<Node name="PackageDependencies" expanded="True" />
24+
</Node>
25+
<Node name="Helpers" expanded="True" />
26+
</Node>
27+
</Node>
28+
</State>
29+
</Pad>
30+
<Pad Id="MonoDevelop.Debugger.WatchPad">
31+
<State />
32+
</Pad>
33+
</Pads>
34+
</MonoDevelop.Ide.Workbench>
35+
</Properties>

.vs/crowdlaunch-backend/xs/project-cache/crowdlaunch-backend-Debug.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

Helpers/DatabaseConfig.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ public class DatabaseConfig
77
public DatabaseConfig()
88
{
99
// Retrieve the database password from the environment variables.
10-
string dbPassword = Environment.GetEnvironmentVariable("DB_PASSWORD") ?? throw new Exception("DB_PASSWORD environment variable not found.");
10+
string dbPassword = Environment.GetEnvironmentVariable("JiTIjugHfVMJzsEo") ?? throw new Exception("DB_PASSWORD environment variable not found.");
1111

1212
// Use the retrieved password to build the connection string or perform other configurations.
1313
// For example:
14-
ConnectionString = $"mongodb+srv://folathecoder:{dbPassword}@crowdlaunchcluster.veylgng.mongodb.net/?retryWrites=true&w=majority";
14+
ConnectionString = $"mongodb+srv://folathecoder:JiTIjugHfVMJzsEo@crowdlaunchcluster.veylgng.mongodb.net/?retryWrites=true&w=majority";
1515
}
1616
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<WebPublishMethod>FileSystem</WebPublishMethod>
5+
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
6+
<LastUsedPlatform>AnyCPU</LastUsedPlatform>
7+
<publishUrl>bin/Release/net7.0/publish</publishUrl>
8+
<DeleteExistingFiles>false</DeleteExistingFiles>
9+
<TargetFramework>net7.0</TargetFramework>
10+
<SelfContained>false</SelfContained>
11+
<_IsPortable>true</_IsPortable>
12+
</PropertyGroup>
13+
</Project>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<WebPublishMethod>ZipDeploy</WebPublishMethod>
5+
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
6+
<LastUsedPlatform>Any CPU</LastUsedPlatform>
7+
<ResourceId>/subscriptions/2a6a3d41-0aaf-47c1-a038-ae8e519751bf/resourceGroups/crowdlaunch/providers/Microsoft.Web/sites/crowdlaunch-backend</ResourceId>
8+
<ResourceGroup>crowdlaunch</ResourceGroup>
9+
<PublishProvider>AzureWebSite</PublishProvider>
10+
<PublishUrl>https://crowdlaunch-backend.scm.azurewebsites.net/</PublishUrl>
11+
<SiteUrlToLaunchAfterPublish>https://crowdlaunch-backend.azurewebsites.net</SiteUrlToLaunchAfterPublish>
12+
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
13+
<UserName>$crowdlaunch-backend</UserName>
14+
<_SavePWD>True</_SavePWD>
15+
</PropertyGroup>
16+
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup />
4+
</Project>

Properties/launchSettings.json

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
{
2-
"$schema": "https://json.schemastore.org/launchsettings.json",
3-
"iisSettings": {
4-
"windowsAuthentication": false,
5-
"anonymousAuthentication": true,
6-
"iisExpress": {
7-
"applicationUrl": "http://localhost:15719",
8-
"sslPort": 44388
9-
}
10-
},
11-
"profiles": {
12-
"BookStoreApi": {
13-
"commandName": "Project",
14-
"dotnetRunMessages": true,
15-
"launchBrowser": true,
16-
"launchUrl": "swagger",
17-
"applicationUrl": "https://localhost:7049;http://localhost:5139",
18-
"environmentVariables": {
19-
"ASPNETCORE_ENVIRONMENT": "Development"
20-
}
21-
},
22-
"IIS Express": {
23-
"commandName": "IISExpress",
24-
"launchBrowser": true,
25-
"launchUrl": "swagger",
26-
"environmentVariables": {
27-
"ASPNETCORE_ENVIRONMENT": "Development"
28-
}
29-
}
30-
}
31-
}
1+
{
2+
"$schema": "https://json.schemastore.org/launchsettings.json",
3+
"iisSettings": {
4+
"windowsAuthentication": false,
5+
"anonymousAuthentication": true,
6+
"iisExpress": {
7+
"applicationUrl": "http://localhost:15719",
8+
"sslPort": 44388
9+
}
10+
},
11+
"profiles": {
12+
"BookStoreApi": {
13+
"commandName": "Project",
14+
"launchBrowser": true,
15+
"launchUrl": "swagger",
16+
"applicationUrl": "https://localhost:7049;http://localhost:5139",
17+
"environmentVariables": {
18+
"ASPNETCORE_ENVIRONMENT": "Development"
19+
},
20+
"dotnetRunMessages": true
21+
},
22+
"IIS Express": {
23+
"commandName": "IISExpress",
24+
"launchBrowser": true,
25+
"launchUrl": "swagger",
26+
"environmentVariables": {
27+
"ASPNETCORE_ENVIRONMENT": "Development"
28+
}
29+
}
30+
}
31+
}

Startup.cs

Lines changed: 105 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using MARKETPLACEAPI.MiddleWare;
22
using Microsoft.AspNetCore.Authentication.JwtBearer;
3+
using Microsoft.AspNetCore.HttpOverrides;
34
using Microsoft.IdentityModel.Tokens;
45
using System.Text;
56
using MARKETPLACEAPI.Models;
@@ -9,46 +10,46 @@
910

1011
public class Startup
1112
{
12-
private readonly IConfiguration _configuration;
13-
14-
public Startup(IConfiguration configuration)
15-
{
16-
_configuration = configuration;
17-
}
18-
19-
public void ConfigureServices(IServiceCollection services)
20-
{
21-
// Add your services configuration here if needed.
22-
services.Configure<MarketPlaceDBSettings>(
23-
_configuration.GetSection("MarketPlaceDatabase"));
24-
services.AddSingleton<UserService>();
25-
services.AddSingleton<ProjectService>();
26-
services.AddSingleton<NftService>();
27-
services.AddSingleton<UserNftService>();
28-
services.AddSingleton<ProjectLikeService>();
29-
services.AddSingleton<NftLikeService>();
30-
services.AddSingleton<PortfolioService>();
31-
services.AddSingleton<ProjectDetailService>();
32-
services.AddSingleton<ProjectUpdateService>();
33-
services.AddSingleton<CategoryService>();
34-
services.AddSingleton<AuthService>();
35-
services.AddControllers();
36-
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
37-
services.AddEndpointsApiExplorer();
38-
services.AddSwaggerGen(
39-
options =>
40-
{
41-
options.SwaggerDoc("v1", new() { Title = "CROWDLAUNCH", Version = "v1" });
42-
options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
43-
{
44-
In = ParameterLocation.Header,
45-
Description = "Enter a vailid token",
46-
Name = "Authorization",
47-
Type = SecuritySchemeType.Http,
48-
BearerFormat = "JWT",
49-
Scheme = "Bearer"
50-
});
51-
options.AddSecurityRequirement(new OpenApiSecurityRequirement {
13+
private readonly IConfiguration _configuration;
14+
15+
public Startup(IConfiguration configuration)
16+
{
17+
_configuration = configuration;
18+
}
19+
20+
public void ConfigureServices(IServiceCollection services)
21+
{
22+
// Add your services configuration here if needed.
23+
services.Configure<MarketPlaceDBSettings>(
24+
_configuration.GetSection("MarketPlaceDatabase"));
25+
services.AddSingleton<UserService>();
26+
services.AddSingleton<ProjectService>();
27+
services.AddSingleton<NftService>();
28+
services.AddSingleton<UserNftService>();
29+
services.AddSingleton<ProjectLikeService>();
30+
services.AddSingleton<NftLikeService>();
31+
services.AddSingleton<PortfolioService>();
32+
services.AddSingleton<ProjectDetailService>();
33+
services.AddSingleton<ProjectUpdateService>();
34+
services.AddSingleton<CategoryService>();
35+
services.AddSingleton<AuthService>();
36+
services.AddControllers();
37+
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
38+
services.AddEndpointsApiExplorer();
39+
services.AddSwaggerGen(
40+
options =>
41+
{
42+
options.SwaggerDoc("v1", new() { Title = "CROWDLAUNCH", Version = "v1" });
43+
options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
44+
{
45+
In = ParameterLocation.Header,
46+
Description = "Enter a vailid token",
47+
Name = "Authorization",
48+
Type = SecuritySchemeType.Http,
49+
BearerFormat = "JWT",
50+
Scheme = "Bearer"
51+
});
52+
options.AddSecurityRequirement(new OpenApiSecurityRequirement {
5253
{
5354
new OpenApiSecurityScheme {
5455
Reference = new OpenApiReference {
@@ -58,67 +59,76 @@ public void ConfigureServices(IServiceCollection services)
5859
},
5960
new string[] {}
6061
}
61-
});
62-
}
63-
);
64-
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
65-
.AddJwtBearer(options =>
66-
{
67-
options.TokenValidationParameters = new TokenValidationParameters
62+
});
63+
}
64+
);
65+
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
66+
.AddJwtBearer(options => {
67+
options.TokenValidationParameters = new TokenValidationParameters
68+
{
69+
ValidateIssuer = true,
70+
ValidateAudience = true,
71+
ValidateLifetime = true,
72+
ValidateIssuerSigningKey = true,
73+
74+
ValidIssuer = _configuration["Jwt:Issuer"],
75+
ValidAudience = _configuration["Jwt:Issuer"],
76+
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Environment.GetEnvironmentVariable("JWT_KEY")!))
77+
};
78+
}
79+
);
80+
81+
services.AddCors(options =>
6882
{
69-
ValidateIssuer = true,
70-
ValidateAudience = true,
71-
ValidateLifetime = true,
72-
ValidateIssuerSigningKey = true,
73-
74-
ValidIssuer = _configuration["Jwt:Issuer"],
75-
ValidAudience = _configuration["Jwt:Issuer"],
76-
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Environment.GetEnvironmentVariable("JWT_KEY")!))
77-
};
78-
}
79-
);
80-
81-
services.AddCors(options =>
82-
{
83-
options.AddPolicy("CorsPolicy", builder => builder
84-
.AllowAnyMethod()
85-
.AllowAnyHeader()
86-
.SetIsOriginAllowed((host) => true)
87-
.AllowCredentials()
88-
);
89-
});
90-
}
91-
92-
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
93-
{
94-
// Other middleware and configurations...
95-
// Configure the HTTP request pipeline.
96-
if (env.IsDevelopment())
97-
{
98-
app.UseSwagger();
99-
app.UseSwaggerUI();
83+
options.AddPolicy("CorsPolicy", builder => builder
84+
.AllowAnyMethod()
85+
.AllowAnyHeader()
86+
.SetIsOriginAllowed((host) => true)
87+
.AllowCredentials()
88+
);
89+
});
10090
}
10191

92+
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
93+
{
94+
// Other middleware and configurations...
95+
// Configure the HTTP request pipeline.
96+
if (env.IsDevelopment())
97+
{
98+
app.UseSwagger();
99+
app.UseSwaggerUI();
100+
}
102101

103-
app.UseHttpsRedirection();
104102

105-
app.UseAuthentication();
106103

107-
app.UseCors("CorsPolicy");
108-
app.UseTokenMiddleware();
109-
// Add the ExceptionLoggingMiddleware to the pipeline.
110-
string logFilePath = Path.Combine(env.ContentRootPath, "exceptions.log");
111-
app.UseMiddleware<ExceptionLoggingMiddleware>(logFilePath);
104+
app.UseHttpsRedirection();
112105

106+
// using Microsoft.AspNetCore.HttpOverrides;
113107

114-
app.UseRouting();
115-
app.UseAuthorization();
116-
app.UseEndpoints(endpoints =>
117-
{
118-
endpoints.MapControllers();
119-
});
108+
app.UseForwardedHeaders(new ForwardedHeadersOptions
109+
{
110+
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
111+
});
112+
113+
app.UseAuthentication();
114+
115+
app.UseAuthentication();
120116

121-
// The following middleware will only execute if an exception is not thrown.
122-
// You can continue adding other middleware to the pipeline here.
123-
}
124-
}
117+
app.UseCors("CorsPolicy");
118+
app.UseTokenMiddleware();
119+
// Add the ExceptionLoggingMiddleware to the pipeline.
120+
string logFilePath = Path.Combine(env.ContentRootPath, "exceptions.log");
121+
app.UseMiddleware<ExceptionLoggingMiddleware>(logFilePath);
122+
123+
124+
app.UseRouting();
125+
app.UseAuthorization();
126+
app.UseEndpoints(endpoints =>
127+
{
128+
endpoints.MapControllers();
129+
});
130+
131+
// The following middleware will only execute if an exception is not thrown.
132+
// You can continue adding other middleware to the pipeline here.
133+
}
134+
}
Binary file not shown.
-488 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)