Add redis prefix option
This commit is contained in:
parent
135d26127b
commit
f9480d096b
4 changed files with 8 additions and 5 deletions
|
@ -3,12 +3,12 @@ using J = System.Text.Json.Serialization.JsonPropertyNameAttribute;
|
|||
namespace Iceshrimp.Backend.Controllers.Schemas;
|
||||
|
||||
public class AuthRequest {
|
||||
[J("username")] public required string Username { get; set; }
|
||||
[J("password")] public required string Password { get; set; }
|
||||
[J("username")] public required string Username { get; set; }
|
||||
[J("password")] public required string Password { get; set; }
|
||||
}
|
||||
|
||||
public class RegistrationRequest : AuthRequest {
|
||||
[J("invite")] public string? Invite { get; set; }
|
||||
[J("invite")] public string? Invite { get; set; }
|
||||
}
|
||||
|
||||
public class ChangePasswordRequest {
|
||||
|
|
|
@ -52,9 +52,10 @@ public sealed class Config {
|
|||
public sealed class RedisSection {
|
||||
public required string Host { get; init; } = "localhost";
|
||||
public required int Port { get; init; } = 6379;
|
||||
public int? Database { get; init; }
|
||||
public string? Prefix { get; init; }
|
||||
public string? Username { get; init; }
|
||||
public string? Password { get; init; }
|
||||
public int? Database { get; init; }
|
||||
|
||||
//TODO: TLS settings
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ public static class ServiceExtensions {
|
|||
var config = configuration.GetSection("Redis").Get<Config.RedisSection>();
|
||||
if (config == null) throw new Exception("Failed to initialize redis: Failed to load configuration");
|
||||
services.AddStackExchangeRedisCache(options => {
|
||||
options.InstanceName = config.Prefix;
|
||||
options.ConfigurationOptions = new ConfigurationOptions {
|
||||
User = config.Username,
|
||||
Password = config.Password,
|
||||
|
|
|
@ -24,9 +24,10 @@ Password = iceshrimp
|
|||
[Redis]
|
||||
Host = localhost
|
||||
Port = 6379
|
||||
;;Database = 0
|
||||
;;Prefix =
|
||||
;;Username =
|
||||
;;Password =
|
||||
;;Database = 0
|
||||
|
||||
[Logging:LogLevel]
|
||||
Default = Information
|
||||
|
|
Loading…
Add table
Reference in a new issue