mirror of
https://github.com/BarkProductions/barkman.git
synced 2026-06-12 22:11:54 +00:00
Merge branch 'main' into api-calls
This commit is contained in:
+3
-1
@@ -2,4 +2,6 @@ bin/
|
||||
obj/
|
||||
/packages/
|
||||
riderModule.iml
|
||||
/_ReSharper.Caches/
|
||||
/_ReSharper.Caches/
|
||||
**/app.db*
|
||||
**/.idea
|
||||
|
||||
@@ -3,6 +3,8 @@ using Microsoft.OpenApi.Models;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
var allowSpecificOrigins = "_AllowSpecificOrigins";
|
||||
|
||||
builder.Services.AddDbContext<BarkContext>();
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen(c =>
|
||||
@@ -10,6 +12,14 @@ builder.Services.AddSwaggerGen(c =>
|
||||
c.SwaggerDoc("v1", new OpenApiInfo { Title = "BarkMan API", Description = "BARK BARK WOOF WOOF", Version = "v1" });
|
||||
});
|
||||
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy(name: allowSpecificOrigins,
|
||||
policy =>
|
||||
{
|
||||
policy.WithOrigins("https://barkdev.ts.drewr.io", "http://localhost:5173");
|
||||
});
|
||||
});
|
||||
var app = builder.Build();
|
||||
|
||||
if (! app.Environment.IsProduction())
|
||||
@@ -81,4 +91,6 @@ using (var serviceScope = app.Services.CreateScope())
|
||||
dbContext.Database.Migrate();
|
||||
}
|
||||
|
||||
app.UseCors(allowSpecificOrigins);
|
||||
|
||||
app.Run();
|
||||
|
||||
@@ -5,5 +5,6 @@
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
"AllowedHosts": "*",
|
||||
"CorsAllowedOrgins": "barkdev.ts.drewr.io"
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public class BarkContext : DbContext
|
||||
{
|
||||
var folder = Environment.SpecialFolder.LocalApplicationData;
|
||||
var path = Environment.GetFolderPath(folder);
|
||||
DbPath = "./app.db";
|
||||
DbPath = "./database/app.db";
|
||||
}
|
||||
|
||||
// The following configures EF to create a Sqlite database file in the
|
||||
|
||||
Reference in New Issue
Block a user