KeyCloak, dbcontext
This commit is contained in:
parent
329cedc660
commit
7e60a2b514
@ -1,7 +1,22 @@
|
||||
version: "3.8"
|
||||
name: "keroosha-pechka-template"
|
||||
|
||||
services:
|
||||
services:
|
||||
keycloak:
|
||||
image: quay.io/keycloak/keycloak:21.1.2
|
||||
ports:
|
||||
- "8080:8080"
|
||||
command:
|
||||
# - "start-dev --import-realm"
|
||||
- "start-dev"
|
||||
# volumes:
|
||||
# - ./realm-export.json:/opt/keycloak/data/import/main-realm.json:ro
|
||||
environment:
|
||||
- "KEYCLOAK_ADMIN=admin"
|
||||
- "KEYCLOAK_ADMIN_PASSWORD=admin"
|
||||
networks:
|
||||
resources:
|
||||
|
||||
db:
|
||||
image: postgres:15-alpine
|
||||
environment:
|
||||
@ -9,6 +24,9 @@ services:
|
||||
POSTGRES_INITDB: 'pechka'
|
||||
ports:
|
||||
- "5432:5432"
|
||||
networks:
|
||||
resources:
|
||||
|
||||
minio:
|
||||
image: quay.io/minio/minio
|
||||
command: server /data --console-address ":19001"
|
||||
@ -18,4 +36,10 @@ services:
|
||||
MINIO_ROOT_PASSWORD: 'pechka'
|
||||
ports:
|
||||
- "19000:9000" # S3 interface
|
||||
- "19001:19001" # Minio console
|
||||
- "19001:19001" # Minio console
|
||||
networks:
|
||||
resources:
|
||||
|
||||
|
||||
networks:
|
||||
resources:
|
21
Keroosha.Pechka.Web/Database/AppDbContext.cs
Normal file
21
Keroosha.Pechka.Web/Database/AppDbContext.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using LinqToDB.Data;
|
||||
using LinqToDB.DataProvider;
|
||||
using Pechka.AspNet.Database;
|
||||
|
||||
namespace Keroosha.Pechka.Web.Database;
|
||||
|
||||
public class AppDbContext : DataConnection
|
||||
{
|
||||
public AppDbContext(string connectionString, IDataProvider provider) : base(provider, connectionString)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class AppDbContextManager : DbContextManagerBase<AppDbContext>
|
||||
{
|
||||
public AppDbContextManager(IDataProvider provider, string connectionString):
|
||||
base(() => new AppDbContext(connectionString, provider))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -12,6 +12,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Database\Migrations\" />
|
||||
<Folder Include="Database\Models\" />
|
||||
<Folder Include="Frontend\src\" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
using Keroosha.Pechka.Web.Database;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
@ -19,6 +20,7 @@ void ConfigureOptions(IConfiguration configuration, IServiceCollection services)
|
||||
|
||||
void ConfigureManagers(IServiceCollection services)
|
||||
{
|
||||
services.AddDbContextManager((z, x) => new AppDbContextManager(z, x));
|
||||
services.AddHttpClient();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user