KeyCloak, dbcontext

This commit is contained in:
Kirill Poletaev 2023-07-02 19:21:42 +03:00
parent 329cedc660
commit 7e60a2b514
4 changed files with 51 additions and 2 deletions

View File

@ -2,6 +2,21 @@ version: "3.8"
name: "keroosha-pechka-template"
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"
@ -19,3 +37,9 @@ services:
ports:
- "19000:9000" # S3 interface
- "19001:19001" # Minio console
networks:
resources:
networks:
resources:

View 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))
{
}
}

View File

@ -12,6 +12,8 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Database\Migrations\" />
<Folder Include="Database\Models\" />
<Folder Include="Frontend\src\" />
</ItemGroup>

View File

@ -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();
}