Repository navigation
Expand file tree
/
Copy pathProgram.cs
More file actions
78 lines (63 loc) · 1.92 KB
/
Copy pathProgram.cs
File metadata and controls
78 lines (63 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using eVilage.Models;
using Microsoft.EntityFrameworkCore;
using Piranha;
using Piranha.AspNetCore.Identity.SQLite;
using Piranha.AttributeBuilder;
using Piranha.Data.EF.SQLite;
using Piranha.Manager.Editor;
var builder = WebApplication.CreateBuilder(args);
builder.AddPiranha(options =>
{
/**
* This will enable automatic reload of .cshtml
* without restarting the application. However since
* this adds a slight overhead it should not be
* enabled in production.
*/
options.AddRazorRuntimeCompilation = true;
options.UseCms();
options.UseManager();
options.UseFileStorage(naming: Piranha.Local.FileStorageNaming.UniqueFolderNames);
options.UseImageSharp();
options.UseTinyMCE();
options.UseMemoryCache();
var connectionString = builder.Configuration.GetConnectionString("piranha");
options.UseEF<SQLiteDb>(db => db.UseSqlite(connectionString));
options.UseIdentityWithSeed<IdentitySQLiteDb>(db => db.UseSqlite(connectionString));
/**
* Here you can configure the different permissions
* that you want to use for securing content in the
* application.
options.UseSecurity(o =>
{
o.UsePermission("WebUser", "Web User");
});
*/
/**
* Here you can specify the login url for the front end
* application. This does not affect the login url of
* the manager interface.
options.LoginUrl = "login";
*/
});
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UsePiranha(options =>
{
// Initialize Piranha
App.Init(options.Api);
//Build content types
new ContentTypeBuilder(options.Api)
.AddAssembly(typeof(Program).Assembly)
.Build()
.DeleteOrphans();
// Configure Tiny MCE
EditorConfig.FromFile("editorconfig.json");
options.UseManager();
options.UseTinyMCE();
options.UseIdentity();
});
app.Run();