add redis #3
@ -15,6 +15,7 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.7" />
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.7" />
|
||||||
|
<PackageReference Include="StackExchange.Redis" Version="2.8.16" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.35.0" />
|
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.35.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -6,12 +6,20 @@ using System.Text;
|
|||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
using FluentValidation.AspNetCore;
|
using FluentValidation.AspNetCore;
|
||||||
using Cloud.Validation;
|
using Cloud.Validation;
|
||||||
|
using StackExchange.Redis;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
|
|
||||||
//Jwt configuration starts here
|
//Redis configuration
|
||||||
|
builder.Services.AddSingleton<IConnectionMultiplexer>(sp =>
|
||||||
|
{
|
||||||
|
var configuration = ConfigurationOptions.Parse("localhost:6379");
|
||||||
|
return ConnectionMultiplexer.Connect(configuration);
|
||||||
|
});
|
||||||
|
|
||||||
|
//Jwt configuration
|
||||||
var jwtIssuer = builder.Configuration.GetSection("Jwt:Issuer").Get<string>();
|
var jwtIssuer = builder.Configuration.GetSection("Jwt:Issuer").Get<string>();
|
||||||
var jwtKey = builder.Configuration.GetSection("Jwt:Key").Get<string>();
|
var jwtKey = builder.Configuration.GetSection("Jwt:Key").Get<string>();
|
||||||
|
|
||||||
|
@ -11,6 +11,21 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- postgres_data:/var/lib/postgresql/data
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: 'redis:latest'
|
||||||
|
ports:
|
||||||
|
- '6379:6379'
|
||||||
|
volumes:
|
||||||
|
- 'cloud-redis:/data'
|
||||||
|
healthcheck:
|
||||||
|
test:
|
||||||
|
- CMD
|
||||||
|
- redis-cli
|
||||||
|
- ping
|
||||||
|
retries: 3
|
||||||
|
timeout: 5s
|
||||||
volumes:
|
volumes:
|
||||||
postgres_data:
|
postgres_data:
|
||||||
driver: local
|
driver: local
|
||||||
|
cloud-redis:
|
||||||
|
driver: local
|
Loading…
Reference in New Issue
Block a user